Windows DLLs and TLS

Denis Shelomovskij verylonglogin.reg at gmail.com
Mon Oct 8 10:57:15 PDT 2012


08.10.2012 15:26, Jakob Ovrum пишет:
> 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
>

What OS do you use? This problem should be related to Windows XP/Server 
2003.

Does you dummy host application in C use implicit TLS?

Do C and D DLLs attached to this post behave differently for you 
regarding to TLS initialisation (load and call `getTLSIndex` and 
`getTLSVarValue`)?

I'll try to help but I need full test suit to see where is the 
difference between C and D DLLs.

-- 
Денис В. Шеломовский
Denis V. Shelomovskij
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DLL tests.7z
Type: application/x-7z-compressed
Size: 1553 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121008/1951dfa0/attachment.7z>


More information about the Digitalmars-d mailing list