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

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 1 14:45:20 PST 2016


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.


More information about the Digitalmars-d-learn mailing list