A focused wrapper around platform-specific loading APIs.
Dynamic-library access differs at the operating-system boundary. This project presents a shared
DynamicLibrary interface while keeping the Windows and POSIX implementations behind the
class. Loaded handles are released by the object destructor, tying resource lifetime to C++ scope.
One lifecycle, two native implementations.
Public APILoad a path and request a function by name.
WindowsLoadLibraryA, GetProcAddress, and FreeLibrary.
POSIXdlopen, dlsym, and dlclose.
Typed lookup with explicit errors.
Factory overloads accept character strings, standard strings, or filesystem paths. Function lookup returns either a callable with the requested signature or an explanatory error string.
[[nodiscard]] static DynamicLibrary load(
const std::filesystem::path&
);
template<typename TFunction>
std::expected<std::function<TFunction>, std::string>
getFunction(const std::string&) const;
A compact experiment, not a full plugin framework.
The repository concentrates on library ownership, symbol resolution, and cross-platform compilation. It does not attempt dependency discovery, version negotiation, hot reloading, or a higher-level plugin protocol. Those boundaries keep the code useful as a study of the native loading layer itself.