35 class SharedObjectLoader {
37 HMODULE shared_object;
39 void ExcludeCurrentDirectory() {
46 if (GetDllDirectory(0, NULL) <= 1) {
47 SetDllDirectory(TEXT(
""));
52 #ifdef ENABLE_UNICODE_PATH_SUPPORT 58 explicit SharedObjectLoader(LPCWSTR pluginName) {
59 ExcludeCurrentDirectory();
61 shared_object = LoadLibraryW(pluginName);
64 THROW_IE_EXCEPTION <<
"Cannot load library '" << details::wStringtoMBCSstringChar(std::wstring(pluginName)) <<
"': " << GetLastError()
65 <<
" from cwd: " << _getcwd(cwd,
sizeof(cwd));
70 explicit SharedObjectLoader(LPCSTR pluginName) {
71 ExcludeCurrentDirectory();
73 shared_object = LoadLibrary(pluginName);
77 <<
" from cwd: " << _getcwd(cwd,
sizeof(cwd));
81 ~SharedObjectLoader() {
82 FreeLibrary(shared_object);
91 void* get_symbol(
const char* symbolName)
const {
93 THROW_IE_EXCEPTION <<
"Cannot get '" << symbolName <<
"' content from unknown library!";
95 auto procAddr =
reinterpret_cast<void*
>(GetProcAddress(shared_object, symbolName));
96 if (procAddr ==
nullptr)
97 THROW_IE_EXCEPTION <<
"GetProcAddress cannot locate method '" << symbolName <<
"': " << GetLastError();
#define THROW_IE_EXCEPTION
A macro used to throw the exception with a notable description.
Definition: ie_exception.hpp:25
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...
This is a header file with functions related to filesystem operations.
A header file for the main Inference Engine exception.