{"id":15047344,"url":"https://github.com/pswgameworkid/dynafen","last_synced_at":"2026-03-17T21:07:18.953Z","repository":{"id":248355665,"uuid":"828459646","full_name":"PSWGameWorkID/dynafen","owner":"PSWGameWorkID","description":"C++11 template-based dynamic library function loader","archived":false,"fork":false,"pushed_at":"2024-07-14T09:00:09.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-13T23:13:42.100Z","etag":null,"topics":["cpp-template","cpp11","dynamic-library","function-loader"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PSWGameWorkID.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-14T08:06:33.000Z","updated_at":"2024-07-14T09:00:12.000Z","dependencies_parsed_at":"2024-07-14T10:09:05.804Z","dependency_job_id":null,"html_url":"https://github.com/PSWGameWorkID/dynafen","commit_stats":null,"previous_names":["pswgameworkid/dynafen"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSWGameWorkID%2Fdynafen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSWGameWorkID%2Fdynafen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSWGameWorkID%2Fdynafen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PSWGameWorkID%2Fdynafen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PSWGameWorkID","download_url":"https://codeload.github.com/PSWGameWorkID/dynafen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243495495,"owners_count":20299923,"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":["cpp-template","cpp11","dynamic-library","function-loader"],"created_at":"2024-09-24T20:56:48.418Z","updated_at":"2025-12-29T21:18:40.706Z","avatar_url":"https://github.com/PSWGameWorkID.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dynafen\nC++11 template-based dynamic library function loader. \n\nOriginally made for a personal experimentation and coding practice.\n\n\u003e [!WARNING]\n\u003e So far only supports dynamic library that is compiled from C code or \n\u003e C++ code that is using `extern \"C\"`, as only code demangling that is\n\u003e available during runtime, but not code mangling.\n\n## Features\n- Cross-platform\n- Library handle is reference counted\n  \u003e Meaning a loaded library will be unloaded if no function in it is no longer needed.\n- Simple function construction.\n- Simple pointer validity check\n- Call imported function like a normal C++ function\n- Good for IDE autocompletion support\n\n## Building and Installation\n### Requirements\n- CMake 3.10 or later\n- C++ Compiler with C++11 variadic template support\n    - LLVM clang 2.9 or later\n    - GNU gcc 4.4 or later\n    - MSVC 18.0 (Visual Studio 2013) or later\n- Build system like Ninja, GNU Make or MSBuild\n\n### Steps\n```bash\n# Clone the repository\ngit clone https://github.com/PSWGameWorkID/dynafen\ncd dynafen\n\n# Build the project ( You can change Ninja to other build system too )\nmkdir build\ncd build\ncmake -B . -S .. -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel\nninja\n\n# Install as system library ( Linux only )\nsudo cmake --install .\n```\n\n### Prebuilt \nThe Release page only have package for x86-64 Linux build with GCC and Clang.\n\n## Exported Functions\n### `#include \u003cdynafen.hxx\u003e`\n- `vdynafen\u003cArgs...\u003e::vdynafen(const char* libPath, const char* symName)`\n  \n    Construct and load an exported function with void return type named `symName` from dynamic library at `libPath`\n- `void vdynafen\u003cArgs..\u003e::operator(Args ...)`\n    \n    Call the exported function\n- `rdynafen\u003cR, Args...\u003e::rdynafen(const char* libPath, const char* symName)`\n    \n    Construct and load an exported function with `R` return type named `symName` from dynamic library at `libPath`\n- `R vdynafen\u003cR, Args..\u003e::operator(Args ...)`\n    \n    Call the exported function\n- `bool dynafen_base::valid()`\n    \n    Check if the pointer is valid, calling invalid pointer may cause undefined behaviour, but mostly crash your app.\n    This call is available for both function classes since `dynafen_base` is it's base class.\n\n## Adding to your Program\n```bash\n# Using installed library\ngcc -o yourprogram -ldynafen \"main.cpp\"\n\n# Using built library, but not installed\ngcc -o yourprogram -I/path/to/lib/dynafen/ -L/path/to/lib/dynafen/build -ldynafen \"main.cpp\"\n```\n\n## Example\n```cpp\n#include \u003cdynafen.hxx\u003e\n\n...\nconst char* const library1 = \"./lib/libmy.1.so\";\nconst char* const mathlib = \"./syslib/libmymath.so\";\nvdynafen\u003c\u003e my_void_function(library1, \"my_void_function\"); // equals to `void my_void_function(void)`\n\nvdynafen\u003cint\u003e my_void_int_function(library1, \"my_void_int_function\"); // equals to `void my_void_int_function(int arg1)`\n\nrdynafen\u003cint, int, int\u003e my_multiply(mathlib, \"my_multiply\"); // equals to `int my_multiply(int, int)`\n\nrdynafen\u003cint\u003e my_getter(library1, \"my_getter\"); // equals to `int my_getter(void)`\n...\n\n// Call like a C++ function\nmy_void_function();\nmy_void_int_function(100);\nint s = my_multiply(10, 10);\nint data = my_getter();\n\n// Check if this function valid\nif(my_getter.valid())\n{\n    int val = my_getter();\n}\n```\n\n## Dependencies\nOnly C++11 Standard Library and platform-specific dynamic loader.\n\n## See Also\n- [martin-olivier/dylib](https://github.com/martin-olivier/dylib) project\n  \n  More featured, more OOP-based approach, overall a better library.\n\n## License\nMIT License ( See [LICENSE](LICENSE) )\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpswgameworkid%2Fdynafen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpswgameworkid%2Fdynafen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpswgameworkid%2Fdynafen/lists"}