[D-runtime] druntime fixes again break Windows DLL support

Sean Kelly sean at invisibleduck.org
Tue Apr 19 13:54:08 PDT 2011


I'd like to hide the use of dll_helper or anything else inside Runtime.initialize(), but this doesn't seem possible because there are things you only want to do when initializing a DLL.  I'd considered adding a Runtime.initializeDLL() routine, but that's Windows-specific.  Any suggestions on how to best handle this?  Perhaps calling something from core.sys.windows really is the best approach?  Don, have you tried the dll_helper routines when loading a DLL, or only Runtime.initalize()?

On Apr 19, 2011, at 1:11 PM, 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.
> 
> I also notice that the docs in 2.052 had an inconsistency: the first
> example used dll_helper, the later ones use Runtime.initialize().
> ---
> 
> On 19 April 2011 20:06, Sean Kelly <sean at invisibleduck.org> wrote:
>> I haven't had time to boot into Windows to test this yet, but here you go:
>> 
>> 
>> 
>> 
>> On Apr 16, 2011, at 10:20 PM, Walter Bright wrote:
>> 
>>> Have you been able to look at this, yet?
>>> 
>>> On 3/28/2011 9:04 AM, Sean Kelly wrote:
>>>> Sounds like we need an automated test for this. The helper modules moved to core.sys.windows. Where is the dll code that broke?  I'll fix it.
>>>> 
>>>> FWIW, I didn't think the helper modules should be explicitly called by the user at all. If this isnt true then the DLL use process needs a look.
>>>> 
>>>> Sent from my iPhone
>>>> 
>>>> On Mar 27, 2011, at 12:18 PM, Walter Bright<walter at digitalmars.com>  wrote:
>>>> 
>>>>> ..\dmd mydll.obj ..\druntime\lib\gcstub.obj mydll.def -L/map
>>>>> OPTLINK (R) for Win32  Release 8.00.12
>>>>> Copyright (C) Digital Mars 1989-2010  All rights reserved.
>>>>> http://www.digitalmars.com/ctg/optlink.html
>>>>> mydll.obj(mydll)
>>>>> Error 42: Symbol Undefined _D4core10dll_helper18dll_process_attachFT4core3sys7windows7windows6HANDL
>>>>> EbZb
>>>>> mydll.obj(mydll)
>>>>> Error 42: Symbol Undefined _D4core10dll_helper18dll_process_detachFT4core3sys7windows7windows6HANDL
>>>>> EbZv
>>>>> mydll.obj(mydll)
>>>>> Error 42: Symbol Undefined _D4core10dll_helper12__ModuleInfoZ
>>>>> --- errorlevel 3
>>>>> _______________________________________________
>>>>> D-runtime mailing list
>>>>> D-runtime at puremagic.com
>>>>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>>>> _______________________________________________
>>>> D-runtime mailing list
>>>> D-runtime at puremagic.com
>>>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>>>> 
>>>> 
>>> _______________________________________________
>>> D-runtime mailing list
>>> D-runtime at puremagic.com
>>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>> 
>> 
>> _______________________________________________
>> D-runtime mailing list
>> D-runtime at puremagic.com
>> http://lists.puremagic.com/mailman/listinfo/d-runtime
>> 
>> 
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime



More information about the D-runtime mailing list