{"id":19483699,"url":"https://github.com/lizhangqu/dlfcn_compat","last_synced_at":"2025-07-26T00:38:18.411Z","repository":{"id":53745297,"uuid":"168474820","full_name":"lizhangqu/dlfcn_compat","owner":"lizhangqu","description":"兼容Android 7.0 dlfcn(dlopen、dlsym、dlclose、dlerror)","archived":false,"fork":false,"pushed_at":"2019-12-23T07:47:37.000Z","size":73,"stargazers_count":160,"open_issues_count":1,"forks_count":38,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-16T11:21:22.429Z","etag":null,"topics":["dlfcn","dlopen","dlsym","nougat"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lizhangqu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-31T06:29:21.000Z","updated_at":"2024-02-29T12:53:06.000Z","dependencies_parsed_at":"2022-09-23T18:50:30.243Z","dependency_job_id":null,"html_url":"https://github.com/lizhangqu/dlfcn_compat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizhangqu%2Fdlfcn_compat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizhangqu%2Fdlfcn_compat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizhangqu%2Fdlfcn_compat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lizhangqu%2Fdlfcn_compat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lizhangqu","download_url":"https://codeload.github.com/lizhangqu/dlfcn_compat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224007839,"owners_count":17240294,"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":["dlfcn","dlopen","dlsym","nougat"],"created_at":"2024-11-10T20:16:23.647Z","updated_at":"2024-11-10T20:16:24.597Z","avatar_url":"https://github.com/lizhangqu.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Thanks\n\nAndroid N的实现来自 https://github.com/avs333/Nougat_dlfunctions\n\n做了一点优化处理\n - 支持除arm之外的CPU架构以支持模拟器，x86，x86_64经过验证没问题，mips和mips64可编译但没经过验证。\n - 支持传递文件名而非绝对路径\n - 不需要进行版本特判，统一使用compat函数，内部进行逻辑分发\n    \n### 技术原理\n\n见美团的《Android远程调试的探索与实现》相关文章中\"符号化\"和\"突破7.0动态链接的限制\"两部分\n\n[Android远程调试的探索与实现](https://tech.meituan.com/2017/07/20/android-remote-debug.html)\n\n\n### 使用方式\n\n引入cmake\n\n```\nset(dlfcn_compat_root_dir /path/to/dlfcn)\nadd_subdirectory(${dlfcn_compat_root_dir} dlfcn)\ninclude_directories(\n         ${dlfcn_compat_root_dir}/include/\n)\n```\n\n链接静态库\n\n```\ntarget_link_libraries(yourSharedLibrary\n        dlfcn_compat_static\n)\n```\n\n引入头文件\n\n```\n#include \"dlfcn_compat.h\"\n```\n\n相关函数\n\n```\nextern \"C\" {\n\nvoid *dlopen_compat(const char *filename, int flags);\n\nvoid *dlsym_compat(void *handle, const char *symbol);\n\nint dlclose_compat(void *handle);\n\nconst char *dlerror_compat();\n\nint get_sdk_level();\n\n}\n```\n\nsample 见 app/src/main/cpp/sample.cpp","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizhangqu%2Fdlfcn_compat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flizhangqu%2Fdlfcn_compat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flizhangqu%2Fdlfcn_compat/lists"}