Skip to content

Commit a0cd593

Browse files
committed
Update code for Windows
Update Lib Mgr to support Windows
1 parent c755b29 commit a0cd593

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Src/PlugIn/CPluginMgr.h

+20-4
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,33 @@ class CPluginMgr : public CErrorHandler
116116
m_sFilePath = sPath;
117117
}
118118

119+
#ifdef WINDOWS
120+
121+
HINSTANCE hLib = LoadLibrary(m_sFilePath.c_str());
122+
if (hLib == NULL)
123+
{
124+
SetErrorText("Failed to load lib at specified path");
125+
return false;
126+
}
127+
128+
auto createPluginInterface = (CreatePluginInterface) GetProcAddress(hDll, "CreatePluginInterface");
129+
130+
#else
131+
119132
void *pLib = dlopen(m_sFilePath.c_str(), RTLD_NOW | RTLD_GLOBAL);
120-
if (pLib == void)
133+
if (pLib == nullptr)
121134
{
122135
auto message = dlerror();
123136

124-
SetErrorText("Failed to load lib at specified path - " + message);
137+
SetErrorText("Failed to load lib at specified path " + message);
125138
return false;
126139
}
127140

128-
auto createPluginInterface = (CreatePluginInterface)dlsym(pLib, "CreatePluginInterface");
129-
if (createPluginInterface)
141+
auto createPluginInterface = (CreatePluginInterface) dlsym(pLib, "CreatePluginInterface");
142+
143+
#endif
144+
145+
if (createPluginInterface != nullptr)
130146
{
131147
m_pPluginInterface = createPluginInterface();
132148
}

0 commit comments

Comments
 (0)