Windows DLLs and TLS
Paulo Pinto
pjmlp at progtools.org
Mon Oct 8 04:37:24 PDT 2012
On Monday, 8 October 2012 at 11:44:28 UTC, Jakob Ovrum wrote:
> I have a bug in one of my programs that I find particularly
> hard to reduce.
>
> I am writing a Windows DLL plugin for the IRC chat client
> HexChat (aka XChat). Problem is, all TLS variables, regardless
> of type, appear to be initialized to complete rubbish values.
> Reading them does not cause an access violation or anything,
> but the initial values are garbage. I am initializing the
> runtime using the helpers found in core.sys.windows.dll [1].
>
> I wrote a dummy host application in C mimicking the loading
> behaviour of HexChat - the TLS variables are initialized
> correctly in this case, even though the DLL file is exactly the
> same.
>
> What is it that a host application can do to break the TLS of a
> D plugin it loads?
>
> [1] http://pastebin.com/rg9uUQMe
Did you already went through this howto?
http://dlang.org/dll.html
More information about the Digitalmars-d
mailing list