Can't find windows' CreateThread function / concurrency.spawn crashes host application
alkololl via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jan 1 16:32:20 PST 2016
On Friday, 1 January 2016 at 22:45:20 UTC, Adam D. Ruppe wrote:
> On Friday, 1 January 2016 at 22:02:46 UTC, alkololl wrote:
>> I've found that std.c.windows.windows doesn't include a
>
> std.c.windows is basically useless. The new version should have
> it in core.sys.windows.windows though I'm not sure if it has
> actually been released yet.
>
> If it isn't in there on your version, you can also just define
> teh function yourself somewhere and use it. Add to your module:
>
> extern(Windows)
> HANDLE CreateThread(
> LPSECURITY_ATTRIBUTES lpThreadAttributes,
> SIZE_T dwStackSize,
> LPTHREAD_START_ROUTINE lpStartAddress,
> LPVOID lpParameter,
> DWORD dwCreationFlags,
> LPDWORD lpThreadId
> );
>
> and then call it. If a type isn't defined you can replace it
> with void* usually.
Thanks, I replaced LPSECURITY_ATTRIBUTES and
LPTHREAD_START_ROUTINE with void* and it works now. Anyhow the
method FreeLibraryAndExitThread, which worked perfectly in the
C++ Dll, doesn't unload the D Dll properly (the call has no
effect at all). Why is that?
More information about the Digitalmars-d-learn
mailing list