apolukhin / Boost.DLL

Library for comfortable work with DLL and DSO
https://boost.org/libs/dll
109 stars 69 forks source link

Provide a no-load flag to enable use of shared_library with maybe-already-loaded libraries #52

Open boldbyteboss opened 3 years ago

boldbyteboss commented 3 years ago

I'd like to use the functionality of Boost.DLL to access libraries that are already loaded in the process, but be able to avoid loading libraries that are not already loaded. Essentially:

boost::dll::shared_library foo("/path/to/some/library", load_mode::dont_load);
if (foo.is_loaded())
{
    // look up functions
}

On POSIX, this would equate to use of RTLD_NOLOAD with dlopen, and on Windows the use of GetModuleHandle() instead of LoadLibary().