Call a function with a function pointer

bearophile bearophileHUGS at lycos.com
Thu Oct 10 08:15:44 PDT 2013


Namespace:

> You mean like this?
> ----
> void foo(T)(extern(C) void function(T*) func) {
> 		
> }
> ----
>
> That prints: Error: basic type expected, not extern	

In theory that's correct, in practice the compiler refuses that, 
it's in Bugzilla, so try to define the type outside the signature 
(untested):

alias TF = extern(C) void function(T*);

void foo(T)(TF func) {}

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list