carb::extras::getLibraryHandleByFilename
Defined in carb/extras/Library.h
-
inline LibraryHandle carb::extras::getLibraryHandleByFilename(const char *libraryName, LibraryFlags flags = 0)
Attempts to retrieve a library’s handle by its filename.
- Thread Safety
This function is safe to call simultaneously from multiple threads, but only as long as another thread is not attempting to unload the library found by this function.
Warning
This function does not increment a library’s reference count, so it is possible (though unlikely) that another thread could be unloading the library and the handle returned from this function is invalid. Only use this function for debugging, or when you know that the returned handle will still be valid.
- Parameters
libraryName – [in] The name of the library to retrieve the handle for. This may either be the full path for the module or just its base filename. This may be
nullptr
to retrieve the handle for the main executable module for the calling process. If the fLibFlagMakeFullLibName flag is used, the library name may omit any platform specific prefix or file extension. The appropriate platform specific name will be generated internally using createLibraryNameForModule().flags – [in] Flags to control the behavior of the operation. This defaults to 0.
- Returns
The handle to the requested library if it is already loaded in the process. Returns
nullptr
if the library is not loaded. This will not load the library if it is not already present in the process. This can be used to test if a library is already loaded.