Skip to content

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

Open
bdash wants to merge 1 commit into
test_expectedfrom
test_dynamic_library
Open

Add bn::base::DynamicLibrary, an abstraction over runtime loading of shared libraries#8547
bdash wants to merge 1 commit into
test_expectedfrom
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.

…shared libraries

`bn::base::DynamicLibrary` opens a shared library at runtime and unloads
it when the object is destroyed. The platform handle can be handled 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
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