31 class SharedObjectLoader {
33 HMODULE shared_object;
35 void ExcludeCurrentDirectory() {
42 if (GetDllDirectory(0, NULL) <= 1) {
43 SetDllDirectory(TEXT(
""));
53 explicit SharedObjectLoader(LPCWSTR pluginName) {
54 ExcludeCurrentDirectory();
56 shared_object = LoadLibraryW(pluginName);
59 THROW_IE_EXCEPTION <<
"Cannot load library '" << details::wStringtoMBCSstringChar(std::wstring(pluginName)) <<
"': " << GetLastError()
60 <<
" from cwd: " << _getcwd(cwd,
sizeof(cwd));
64 explicit SharedObjectLoader(LPCSTR pluginName) {
65 ExcludeCurrentDirectory();
67 shared_object = LoadLibrary(pluginName);
71 <<
" from cwd: " << _getcwd(cwd,
sizeof(cwd));
75 ~SharedObjectLoader() {
76 FreeLibrary(shared_object);
85 void* get_symbol(
const char* symbolName)
const {
87 THROW_IE_EXCEPTION <<
"Cannot get '" << symbolName <<
"' content from unknown library!";
89 auto procAddr =
reinterpret_cast<void*
>(GetProcAddress(shared_object, symbolName));
90 if (procAddr ==
nullptr)
91 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.