Mercurial > hg > orthanc
changeset 1028:20ccb7e2bc09
merge
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 10 Jul 2014 12:19:05 +0200 |
parents | a13ccd93df28 (diff) ab6a51f075fd (current diff) |
children | 9e04f9f36096 |
files | |
diffstat | 3 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Engine/PluginsManager.cpp Thu Jul 10 12:04:18 2014 +0200 +++ b/Plugins/Engine/PluginsManager.cpp Thu Jul 10 12:19:05 2014 +0200 @@ -44,6 +44,8 @@ #define PLUGIN_EXTENSION ".dll" #elif defined(__linux) #define PLUGIN_EXTENSION ".so" +#elif defined(__APPLE__) && defined(__MACH__) +#define PLUGIN_EXTENSION ".dylib" #else #error Support your platform here #endif
--- a/Plugins/Engine/SharedLibrary.cpp Thu Jul 10 12:04:18 2014 +0200 +++ b/Plugins/Engine/SharedLibrary.cpp Thu Jul 10 12:19:05 2014 +0200 @@ -36,7 +36,7 @@ #if defined(_WIN32) #include <windows.h> -#elif defined(__linux) +#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) #include <dlfcn.h> #else #error Support your platform here @@ -58,7 +58,7 @@ throw OrthancException(ErrorCode_SharedLibrary); } -#elif defined(__linux) +#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) handle_ = ::dlopen(path.c_str(), RTLD_NOW); if (handle_ == NULL) { @@ -84,7 +84,7 @@ { #if defined(_WIN32) ::FreeLibrary((HMODULE)handle_); -#elif defined(__linux) +#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) ::dlclose(handle_); #else #error Support your platform here @@ -102,7 +102,7 @@ #if defined(_WIN32) return ::GetProcAddress((HMODULE)handle_, name.c_str()); -#elif defined(__linux) +#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) return ::dlsym(handle_, name.c_str()); #else #error Support your platform here
--- a/UnitTestsSources/PluginsTests.cpp Thu Jul 10 12:04:18 2014 +0200 +++ b/UnitTestsSources/PluginsTests.cpp Thu Jul 10 12:19:05 2014 +0200 @@ -55,6 +55,13 @@ ASSERT_TRUE(l.HasFunction("dlclose")); ASSERT_FALSE(l.HasFunction("world")); +#elif defined(__APPLE__) && defined(__MACH__) + SharedLibrary l("libdl.dylib"); + ASSERT_THROW(l.GetFunction("world"), OrthancException); + ASSERT_TRUE(l.GetFunction("dlopen") != NULL); + ASSERT_TRUE(l.HasFunction("dlclose")); + ASSERT_FALSE(l.HasFunction("world")); + #else #error Support your platform here #endif