{"id":17800435,"url":"https://github.com/anntzer/dlsym","last_synced_at":"2025-04-02T04:41:35.042Z","repository":{"id":57423003,"uuid":"349422881","full_name":"anntzer/dlsym","owner":"anntzer","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-20T15:37:06.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-10T11:47:38.525Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anntzer.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-19T12:55:34.000Z","updated_at":"2023-10-20T13:38:21.000Z","dependencies_parsed_at":"2024-10-27T12:47:56.092Z","dependency_job_id":"c30b9d19-dd5c-4c14-b1be-226700674800","html_url":"https://github.com/anntzer/dlsym","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"1f9cdaa6ab5f7e652cacd759076f6bf9c805e3f7"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anntzer%2Fdlsym","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anntzer%2Fdlsym/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anntzer%2Fdlsym/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anntzer%2Fdlsym/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anntzer","download_url":"https://codeload.github.com/anntzer/dlsym/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246758279,"owners_count":20828919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-27T12:21:56.679Z","updated_at":"2025-04-02T04:41:35.028Z","avatar_url":"https://github.com/anntzer.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"dlsym -- A cross-platform symbol locator\n========================================\n\n|GitHub| |PyPI|\n\n.. |GitHub|\n   image:: https://img.shields.io/badge/github-anntzer%2Fdlsym-brightgreen\n   :target: https://github.com/anntzer/dlsym\n.. |PyPI|\n   image:: https://img.shields.io/pypi/v/dlsym.svg?color=brightgreen\n   :target: https://pypi.python.org/pypi/dlsym\n\n``dlsym`` allows Python C extension modules to use symbols present in already\nloaded C libraries, without having to actually link these libraries.  As a\nsimple example, using pybind11_:\n\n.. code-block:: cpp\n\n   double (* my_atan2)(double, double);\n   my_atan2 = reinterpret_cast\u003cdecltype(my_atan2)\u003e(\n       py::module::import(\"dlsym\").attr(\"dlsym\")(\"atan2\").cast\u003cuintptr_t\u003e());\n\n.. _pybind11: https://pybind11.readthedocs.io/\n\nObviously, linking against ``libm`` to get access to ``atan2`` is not\nparticularly difficult, but this approach also allows one to use e.g.\n``numpy``-provided BLAS/LAPACK functions which are available after importing\n``numpy`` (regardless of whether the underlying implementation is OpenBLAS,\nMKL, or something else), ``fftw`` functions after importing ``pyfftw``, or\n``Tcl/Tk`` functions after importing ``tkinter`` (see tests for examples).\n\nThe main goal here is to simplify the compilation of such extension modules on\nmachines where the C libraries may not be present by default, but where they\ncan be \"requested\" by declaring an ``install_requires`` on the corresponding\nPython package.\n\nNote that the path to the shared library is not actually passed as an argument\nto ``dlsym`` (unlike the POSIX ``dlsym(3)``.  This is because the symbol search\non Windows has to enumerate all loaded modules anyways, as one cannot just\npass a module that transitively loads the symbol.  On POSIX, we thus follow\nthe same strategy for consistency (but enumerating all extension modules in\n``sys.modules`` instead).\n\nThe path of the library where the symbol is actually defined is logged at the\nINFO level.\n\nI learned this trick from Matthew Brett's original implementation for loading\n``tkinter`` into ``matplotlib``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanntzer%2Fdlsym","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanntzer%2Fdlsym","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanntzer%2Fdlsym/lists"}