c function as parameter

Simen kjaeraas simen.kjaras at gmail.com
Sat May 15 08:37:58 PDT 2010


useo6 <useo6 at start.bg> wrote:

> Hello everyone,
>
> I'm trying to create a function which awaits a C function as  
> parameter... like this:
>
> void myfunction(void C function(uint, void*)) {
> ....
> }
>
> But... when I try to compile it, I get the follwing error:
> "found 'function' when expecting ')'".
> Does anyone knwo what's wrong with my parameters or is it impossible to  
> create such function?
>
> Thx for help :).

You will have to use an alias for this:

alias extern( C ) void function( uint, void* ) myCFunction;

void myfunction( myCFunction param ) {
}

-- 
Simen


More information about the Digitalmars-d-learn mailing list