Mercurial > hg > orthanc-wsi
comparison Resources/Orthanc/Plugins/Engine/SharedLibrary.cpp @ 107:a3e8ac8b7256
support for OpenBSD
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 23 Aug 2017 11:10:48 +0200 |
parents | ff0ef01c332c |
children | a18bfe1fdd62 |
comparison
equal
deleted
inserted
replaced
105:42dcf1438943 | 107:a3e8ac8b7256 |
---|---|
44 | 44 |
45 #include <boost/filesystem.hpp> | 45 #include <boost/filesystem.hpp> |
46 | 46 |
47 #if defined(_WIN32) | 47 #if defined(_WIN32) |
48 #include <windows.h> | 48 #include <windows.h> |
49 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) | 49 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
50 #include <dlfcn.h> | 50 #include <dlfcn.h> |
51 #else | 51 #else |
52 #error Support your platform here | 52 #error Support your platform here |
53 #endif | 53 #endif |
54 | 54 |
64 { | 64 { |
65 LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError(); | 65 LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError(); |
66 throw OrthancException(ErrorCode_SharedLibrary); | 66 throw OrthancException(ErrorCode_SharedLibrary); |
67 } | 67 } |
68 | 68 |
69 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) | 69 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
70 handle_ = ::dlopen(path_.c_str(), RTLD_NOW); | 70 handle_ = ::dlopen(path_.c_str(), RTLD_NOW); |
71 if (handle_ == NULL) | 71 if (handle_ == NULL) |
72 { | 72 { |
73 std::string explanation; | 73 std::string explanation; |
74 const char *tmp = ::dlerror(); | 74 const char *tmp = ::dlerror(); |
90 { | 90 { |
91 if (handle_) | 91 if (handle_) |
92 { | 92 { |
93 #if defined(_WIN32) | 93 #if defined(_WIN32) |
94 ::FreeLibrary((HMODULE)handle_); | 94 ::FreeLibrary((HMODULE)handle_); |
95 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) | 95 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
96 ::dlclose(handle_); | 96 ::dlclose(handle_); |
97 #else | 97 #else |
98 #error Support your platform here | 98 #error Support your platform here |
99 #endif | 99 #endif |
100 } | 100 } |
108 throw OrthancException(ErrorCode_InternalError); | 108 throw OrthancException(ErrorCode_InternalError); |
109 } | 109 } |
110 | 110 |
111 #if defined(_WIN32) | 111 #if defined(_WIN32) |
112 return ::GetProcAddress((HMODULE)handle_, name.c_str()); | 112 return ::GetProcAddress((HMODULE)handle_, name.c_str()); |
113 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) | 113 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) |
114 return ::dlsym(handle_, name.c_str()); | 114 return ::dlsym(handle_, name.c_str()); |
115 #else | 115 #else |
116 #error Support your platform here | 116 #error Support your platform here |
117 #endif | 117 #endif |
118 } | 118 } |