[D-runtime] druntime fixes again break Windows DLL support
Don Clugston
dclugston at googlemail.com
Tue Apr 19 23:55:00 PDT 2011
On 20 April 2011 08:47, Rainer Schuetze <r.sagitario at gmx.de> wrote:
>
>
> Don Clugston wrote:
>>
>> I've also had problems with DLLs in the git version of druntime.
>> When I use Runtime.initialize() in a thread, in a DLL which was
>> dynamically loaded, it crashes. I haven't traced into it, but it feels
>> like exactly the same behaviour I saw when TLS wasn't initialized.
>> Almost as if something in the runtime is using a TLS variable before
>> initialization has happened.
>
> Recently, I also started creating threads in a DLL, and that revealed a few
> inconsistencies between dll_helper.d and thread.d. The major problem is that
> DLLMain is called before the thread is added to the list of library created
> threads, causing initialization to be done twice.
> I have a patch for this, but I'm not yet on the latest git-version. I'll try
> to update the bugzilla entry
> http://d.puremagic.com/issues/show_bug.cgi?id=5582 with it and maybe even
> create a pull request.
>
>
>> I also notice that the docs in 2.052 had an inconsistency: the first
>> example used dll_helper, the later ones use Runtime.initialize().
>
> When updating the DLL init code, I also changed the "DLLs with a C
> Interface" part in the docs, but as I'm not convinced that the approach used
> by "D code calling D code in DLLs" is good enough, I left it as is. My
> suggestion here would be to use a common phobos.DLL to share all runtime
> library functions including the GC (as shown here:
> http://d.puremagic.com/issues/show_bug.cgi?id=4071 )
The "DLLs with a C interface" part imports core.dll_helper, which no
longer exists. What should it be now?
More information about the D-runtime
mailing list