I have this C function that just calls another function passed as parameter
void call_my_function(void (*callback_function)())
{
callback_function();
}
This is test code C:
void func_to_call()
{
printf("function correctly called");
}
void test()
{
void (*foo)();
foo = &func_to_call;
call_my_function(foo);
}
Essentially, from test(), I call call_my_function(), passing in the address func_to_call(), and then call_my_function()accessing func_to_call().
With fast, I see functions correctly test()and func_to_call(), but it seems that
void call_my_function(void (*callback_function)())
not recognized (using an unresolved identifier) If I delete a parameter void (*callback_function)(), the function is recognized again.
What can I do to pass the address of the Swift function to C and return it? Is it possible? Thanks
source
share