Windows DLLs and TLS

Denis Shelomovskij verylonglogin.reg at gmail.com
Mon Oct 8 12:02:01 PDT 2012


08.10.2012 22:35, Jakob Ovrum пишет:
> On Monday, 8 October 2012 at 18:05:31 UTC, Rainer Schuetze wrote:
>> What OS are you running? Implicite TLS for dynamically loaded DLLs is
>> not supported by XP or Sever 2003, so druntime contains a fix to
>> simulate it. (The workaround has the drawback that the DLL cannot be
>> unloaded anymore.)
>>
>> I'm just speculating, maybe something goes wrong with the tls_index
>> variable, reading TLS variables would then access data from another DLL.
>>
>> Is your code doing callbacks into the host application in static
>> initializers? With the XP workaround, the runtime initialization
>> "impersonates" all threads that exist before loading the DLL, by
>> switching the TLS-pointer array of the current thread, and that might
>> be unexpected in a callback (but not doing this might produce even
>> more unexpected results).
>
> I'm running Windows 7, and I'm not using any static initializers either :(
>

As I said, give us a runnable failing test suite.

As you are running Windows 7 the only reason I see is this nasty trap:
http://d.puremagic.com/issues/show_bug.cgi?id=8130

Are you aware of it?

-- 
Денис В. Шеломовский
Denis V. Shelomovskij


More information about the Digitalmars-d mailing list