Sign in to follow this  
McZ

can't load .dll file

Recommended Posts

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
	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();

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'

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this