Why I get delegate when passing address of function?

Injeckt vinsentlou9 at gmail.com
Sun Sep 11 09:02:31 UTC 2022


I have a one class and two modificators, where in "public" 
function I'm calling CreateThread with address of the 
ClientThread function which stored in same class, but in 
"private" modificator.

And i get this error:
Error: cannot pass argument `&this.ClientThread` of type `extern 
(Windows) uint delegate(void* param)` to parameter `extern 
(Windows) uint function(void*) @system`.


     public:
         void server_init() {
             CreateThread(NULL, 0, &this.ClientThread, 
cast(PVOID)clientSocket, 0, NULL);
         }

     private:
         extern(Windows)
         DWORD ClientThread(PVOID param) {
             this.log("\nHello from thread\n");
             return 0;
         }


More information about the Digitalmars-d-learn mailing list