Windows DLLs and TLS
jakobovrum at gmail.com
Mon Oct 8 11:32:40 PDT 2012
On Monday, 8 October 2012 at 17:20:03 UTC, Regan Heath wrote:
> Could XChat be loading your dll using:
> and the flag DONT_RESOLVE_DLL_REFERENCES, or similar.
> To debug, I would write a debug file using *C* IO functions
> from DllMain, check it loads/runs/outputs to the file from your
> dummy C host application, then try again with XChat and see
> what you get.
> You could also alter the dummy C host application to call
> LoadLibraryEx and pass DONT_RESOLVE_DLL_REFERENCES and see what
Upon loading the application, which is when plugins are loaded,
DLL_PROCESS_ATTACH is invoked once. Subsequently,
DLL_THREAD_ATTACH is invoked 4 times. Then after about a second,
still during startup, DLL_THREAD_DETACH is invoked twice.
DLL_PROCESS_DETACH is then invoked once when closing the
XChat uses gmodule - part of glib - to load plugins. I looked at
gmodule's Windows implementation, and it uses LoadLibraryW.
Despite finding all this, I still tried modifying the dummy host
to use LoadLibraryEx out of curiosity. An access violation occurs
in some druntime exception handling code as soon as I call into
the plugin's init function.
More information about the Digitalmars-d