diff options
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r-- | cocoa/PlatCocoa.mm | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index 3939147c2..ff1e3d013 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -2136,55 +2136,4 @@ void Platform::Assert(const char *c, const char *file, int line) noexcept { #endif } -//----------------- DynamicLibrary ----------------------------------------------------------------- - -/** - * Platform-specific module loading and access. - * Uses POSIX calls dlopen, dlsym, dlclose. - */ - -class DynamicLibraryImpl : public DynamicLibrary { -protected: - void *m; -public: - explicit DynamicLibraryImpl(const char *modulePath) noexcept { - m = dlopen(modulePath, RTLD_LAZY); - } - // Deleted so DynamicLibraryImpl objects can not be copied. - DynamicLibraryImpl(const DynamicLibraryImpl&) = delete; - DynamicLibraryImpl(DynamicLibraryImpl&&) = delete; - DynamicLibraryImpl&operator=(const DynamicLibraryImpl&) = delete; - DynamicLibraryImpl&operator=(DynamicLibraryImpl&&) = delete; - - ~DynamicLibraryImpl() override { - if (m) - dlclose(m); - } - - // Use dlsym to get a pointer to the relevant function. - Function FindFunction(const char *name) override { - if (m) { - return dlsym(m, name); - } else { - return nullptr; - } - } - - bool IsValid() override { - return m != nullptr; - } -}; - -/** -* Implements the platform specific part of library loading. -* -* @param modulePath The path to the module to load. -* @return A library instance or nullptr if the module could not be found or another problem occurred. -*/ - -DynamicLibrary *DynamicLibrary::Load(const char *modulePath) { - return static_cast<DynamicLibrary *>(new DynamicLibraryImpl(modulePath)); -} - //-------------------------------------------------------------------------------------------------- - |