Can't find windows' CreateThread function / concurrency.spawn crashes host application

Rainer Schuetze via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 4 04:25:25 PST 2016



On 02.01.2016 18:41, alkololl wrote:
> On Saturday, 2 January 2016 at 16:42:46 UTC, Rainer Schuetze wrote:
>
>> On 02.01.2016 16:34, alkololl wrote:
>>> On Saturday, 2 January 2016 at 01:44:46 UTC, Adam D. Ruppe wrote:
>>>> [...]
>>>
>>> Thanks for your reply. I replaced my switch statement with the one
>>> behind the link you left but the result (no result) stays the same. The
>>> Dll doesn't get unloaded. Not until I close the host application.
>>
>> D needs "implicite thread local storage" to implement thread local
>> variables, but Windows XP and earlier versions do not support this for
>> DLLs dynamically loaded through LoadLibrary. The D runtime implements
>> the part necessary for loading, but does not support unloading. As a
>> consequence it sets the DLL to never unload.
>>
>> If you are actually running XP, you can check
>> https://github.com/denis-sh/hooking. IIRC Denis Shelomovskij
>> implemented the missing parts.
>
> What? I'm actually running Windows 7. For me it's inevitable to not
> unload the D Dll dynamically. Isn't there some kind of workaround or a
> sneaky hack to solve this?

If you run Windows 7, I guess the runtime patch is not the issue here.

Have you tried to load the DLL explicitely (without injecting it)? Does 
it unload correctly in this case? If not, it should ease debugging the 
problem.


More information about the Digitalmars-d-learn mailing list