Why I get delegate when passing address of function?

Mike Parker aldacron at gmail.com
Sun Sep 11 09:15:11 UTC 2022


On Sunday, 11 September 2022 at 09:02:31 UTC, Injeckt wrote:
> 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`.
>

Pointers to non-static member functions always produce a 
delegate. Otherwise, you wouldn't be able to access the class 
instance's members.


More information about the Digitalmars-d-learn mailing list