HINSTANCE DllHandle;
typedef void (*PFNSTARTPLUGIN) ( void );
PFNSTARTPLUGIN StartPlugin;
DllHandle = LoadLibrary(FileName);
if( !DllHandle )
{
logErrorMessage("Failed to load plugin %s", FileName);
return false;
}
StartPlugin = (PFNSTARTPLUGIN) GetProcAddress(DllHandle, "StartPlugin");
if( !StartPlugin )
{
logErrorMessage("Failed to start plugin %s", FileName);
return false;
}
StartPlugin();
can't load .dll file
well.. I have a wierd problem, I have two plugin dll files, one old and one new.. the problem is that I can't load the new one even though they are the same
Dll load code
in the plugin.dll files I have this
PLUGINDLL_API void StartPlugin(void)
{
MessageBox(NULL, "Plugin A", "Plugin", MB_OK);
}
and the same in plugin B, and I have a .def file one for each .dll file they looks like this
LIBRARY Plugin
EXPORTS
StartPlugin @1
I'm using VS.Net 2k3 altough the old plugin that works was once created in VS 6.0 and then converted to VS.Net 2k3 and the new plugin was created in VS.Net 2k3 thats the only difference I can find. but still I can't start the second plugin, It fails on 'StartPlugin'
C or C++? If it's C++, don't forget extern "C". As it will be subject to C++ name mangling, and GetProcAddress will need another name to find it :P
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement