comparison Plugins/Engine/SharedLibrary.cpp @ 893:f57802f8b4dc plugins

plugins for windows
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Jun 2014 16:14:56 +0200
parents 4066e6f2d134
children a13ccd93df28
comparison
equal deleted inserted replaced
892:517e28b420af 893:f57802f8b4dc
50 path_(path), 50 path_(path),
51 handle_(NULL) 51 handle_(NULL)
52 { 52 {
53 #if defined(_WIN32) 53 #if defined(_WIN32)
54 handle_ = ::LoadLibraryA(path.c_str()); 54 handle_ = ::LoadLibraryA(path.c_str());
55 if (handle == NULL) 55 if (handle_ == NULL)
56 { 56 {
57 LOG(ERROR) << "LoadLibrary(" << path << ") failed: Error " << ::GetLastError(); 57 LOG(ERROR) << "LoadLibrary(" << path << ") failed: Error " << ::GetLastError();
58 throw OrthancException(ErrorCode_SharedLibrary); 58 throw OrthancException(ErrorCode_SharedLibrary);
59 } 59 }
60 60
91 #endif 91 #endif
92 } 92 }
93 } 93 }
94 94
95 95
96 void* SharedLibrary::GetFunctionInternal(const std::string& name) 96 SharedLibrary::FunctionPointer SharedLibrary::GetFunctionInternal(const std::string& name)
97 { 97 {
98 if (!handle_) 98 if (!handle_)
99 { 99 {
100 throw OrthancException(ErrorCode_InternalError); 100 throw OrthancException(ErrorCode_InternalError);
101 } 101 }
108 #error Support your platform here 108 #error Support your platform here
109 #endif 109 #endif
110 } 110 }
111 111
112 112
113 void* SharedLibrary::GetFunction(const std::string& name) 113 SharedLibrary::FunctionPointer SharedLibrary::GetFunction(const std::string& name)
114 { 114 {
115 void* result = GetFunctionInternal(name); 115 SharedLibrary::FunctionPointer result = GetFunctionInternal(name);
116 116
117 if (result == NULL) 117 if (result == NULL)
118 { 118 {
119 LOG(ERROR) << "Shared library does not expose function \"" << name << "\""; 119 LOG(ERROR) << "Shared library does not expose function \"" << name << "\"";
120 throw OrthancException(ErrorCode_SharedLibrary); 120 throw OrthancException(ErrorCode_SharedLibrary);