Re: How create Win32api Thread in Dlang?

2020-09-25 Thread Adam D. Ruppe via Digitalmars-d-learn

On Saturday, 26 September 2020 at 03:08:56 UTC, Marcone wrote:

#include 


import core.sys.windows.windows


WINAPI


extern(Windows)


int main(int argc, char *argv[]) {


int main(string[] args)


  CreateThread(NULL, 0, threadFunc, NULL, 0, NULL);


   CreateThread(null, 0, &threadFunc, null, 0, null);



Maybe minor compile errors like required casts but this is really 
about it. You can almost literally copy/paste most C examples to 
D.


How create Win32api Thread in Dlang?

2020-09-25 Thread Marcone via Digitalmars-d-learn

This is C++ code:

#include 

WINAPI DWORD threadFunc(LPVOID x) {
  while (true) {
try {
  throw 1;
} catch (...) {
}
  }
  return 0;
}

int main(int argc, char *argv[]) {
  CreateThread(NULL, 0, threadFunc, NULL, 0, NULL);
  CreateThread(NULL, 0, threadFunc, NULL, 0, NULL);

  Sleep(1000);

  return 0;
}

How can I convert it to Dlang?