Added closeSharedLibrary().

This commit is contained in:
Patrick 2024-07-27 11:32:56 +02:00
parent 8b55786e77
commit 232e2a3e28
2 changed files with 11 additions and 0 deletions

View File

@ -51,6 +51,16 @@ LibraryHandle openSharedLibrary(std::string_view libraryFile) noexcept
#endif
}
bool closeSharedLibrary(const LibraryHandle library) noexcept
{
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX
return dlclose(library.data) == 0;
#elif MIJIN_TARGET_OS == MIJIN_OS_WINDOWS
(void) library;
return true;
#endif
}
void* loadSymbolFromLibrary(const LibraryHandle library, const char* symbolName) noexcept
{
#if MIJIN_TARGET_OS == MIJIN_OS_LINUX

View File

@ -46,6 +46,7 @@ struct LibraryHandle
//
[[nodiscard]] LibraryHandle openSharedLibrary(std::string_view libraryFile) noexcept;
bool closeSharedLibrary(const LibraryHandle library) noexcept;
[[nodiscard]] void* loadSymbolFromLibrary(const LibraryHandle library, const char* symbolName) noexcept;
void setCurrentThreadName(const char* threadName) noexcept;