D hates to be dynamic linked
Don
nospam at nospam.com
Tue Mar 9 12:01:14 PST 2010
Rainer Schuetze wrote:
> I knew that blog, but I expected to find the necessary data somewhere in
> the "undocumented" (but still available) structures.
>
> But I had to dig a little deeper into ntdll myself and came up with a
> patch that is part of the multithread-support for DLLs:
>
> http://d.puremagic.com/issues/show_bug.cgi?id=3885
>
> It emulates the behaviour at process startup time, and modifies the data
> structures so that windows handles the DLL as if it was loaded with the
> process. This has the nice benefit that you don't need to handle the
> creation of new threads.
>
> The downsides are:
> - DLL-unload is disabled, but I think unloading a DLL that uses TLS is
> problematic anyway)
> - It will leak some pointer-arrays in favor of not causing crashes due
> to other threads using TLS at same time as reallocating these arrays.
>
> As XP is not a fast moving target anymore, I hope that ntdll will not
> change a lot, so it will not need adjustment for every windows-update.
> I've checked SP2 and SP3, which look very much the same with respect to
> TLS implementation.
>
> Rainer
You're totally awesome. This is a game-changer.
More information about the Digitalmars-d
mailing list