Skip to content

Add bn::base::DynamicLibrary, an abstraction over runtime loading of shared libraries - #8547

Merged
bdash merged 1 commit into
devfrom
test_dynamic_library
Sep 16, 2026
Merged

bdash merged 1 commit into
devfrom
test_dynamic_library

Conversation

@bdash

@bdash bdash commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

bn::base::DynamicLibrary opens a shared library at runtime and unloads it when the object is destroyed. The platform handle can be handed off with Release() when the library should remain loaded indefinitely. Open() returns either the library or the platform's description of why it could not be loaded.

SymbolScope chooses whether GetSymbol() also resolves symbols from the libraries that the loaded library links against. Each platform restricts this differently, so macOS passes RTLD_FIRST to dlopen(), other Unixes check which image defines each symbol, and Windows only ever searches the module itself.

@bdash
bdash added this pull request to stack #8548 September 10, 2026 17:35
…shared libraries

`bn::base::DynamicLibrary` opens a shared library at runtime and unloads
it when the object is destroyed. The platform handle can be handed off
with `Release()` when the library should remain loaded indefinitely.
`Open()` returns either the library or the platform's description of why
it could not be loaded.

`SymbolScope` chooses whether `GetSymbol()` also resolves symbols from
the libraries that the loaded library links against. Each platform
restricts this differently, so macOS passes `RTLD_FIRST` to `dlopen()`,
other Unixes check which image defines each symbol, and Windows only
ever searches the module itself.
@bdash
bdash force-pushed the test_dynamic_library branch from 7c7fae5 to 527ff80 Compare September 16, 2026 00:58
Base automatically changed from test_expected to dev September 16, 2026 01:00
@bdash
bdash merged commit 527ff80 into dev Sep 16, 2026
5 checks passed
@bdash
bdash deleted the test_dynamic_library branch September 16, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant