Call a function with a function pointer
Namespace
rswhite4 at googlemail.com
Thu Oct 10 07:40:08 PDT 2013
On Thursday, 10 October 2013 at 14:28:20 UTC, Dicebot wrote:
> On Thursday, 10 October 2013 at 14:13:47 UTC, Namespace wrote:
>> I have this function:
>> ----
>> void foo(T)(void function(T*) test) { }
>> ----
>>
>> And want to call it with a C function:
>> ----
>> foo!(SDL_Surface)(SDL_FreeSurface);
>> ----
>>
>> but I get:
>> Fehler 1 Error: foo (void function(SDL_Surface*) test) is not
>> callable using argument types (extern (C) void
>> function(SDL_Surface*) nothrow)
>>
>> What would be the smartest solution?
>
> Wrap it in a lambda.
Example? I do not use lambdas often.
More information about the Digitalmars-d-learn
mailing list