diff --git a/source/mijin/util/os.cpp b/source/mijin/util/os.cpp index f3537b9..f483d3e 100644 --- a/source/mijin/util/os.cpp +++ b/source/mijin/util/os.cpp @@ -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 diff --git a/source/mijin/util/os.hpp b/source/mijin/util/os.hpp index 616ffc5..297a104 100644 --- a/source/mijin/util/os.hpp +++ b/source/mijin/util/os.hpp @@ -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;