Sunday, May 1, 2011

Problems using dynamic linked libraries (wxWidgets) from a DLL

We created a plugin; it is a DLL (Run-Time Dynamic Linking) which uses a 3rd party library (wxWidgets) and also links dynamically to that. The host software seems to scan our plugin, but exported functions are not called. We checked all dependencies with DependencyWalker.

We see in the debugger that the plugin is loaded, but the DllMain is not called, and the plugin is unloaded.

We tried loading our plugin from a simple test application using LoadLibrary and GetProcAddress which recognized and called the exported functions.

Having wxWidgets linked statically worked fine, though.

Does anyone have an idea why the exported function, respectively DllMain are not called, or can point out a tool which is capable to monitor the whole DLL loading process?

From stackoverflow
  • If wxWidgets is loaded already into the process address space before your plugin is loaded (the host app could do that, or there might be another plugin linking to wxWidgets which is loaded before yours), then there might be a chance that it is another version, missing some of the entry points that your plugin needs. Running the host app under DependencyWalker or WinDbg should show you which wxWidgets DLL is loaded, and you could try to load your plugin from your test app using exactly the same wxWidgets DLL. That should reveal whether there are missing dependencies.

  • Perhaps the host software does some funky things when loading the plugin and doesn't like wxWindows.

    Anyways, try using the ProcessExplorer from the SysInternals suite to check what the process is doing.

  • there's something usefull.... maybe that can help you....

    http://taringa.net/posts/ebooks-tutoriales/6888465/wxWidgets-y-DLL-de-recursos.html

0 comments:

Post a Comment