For anyone that is interested doing this
using Cxx
cxx"""
void evaluatec(void (*f)() ){
f();
}
"""
function evaluate(f)
f_void_ptr = @cfunction($f, Cvoid, ()) # void pointer on f. Need to cast it to function pointer
f_void_ptr2 = f_void_ptr.ptr
#show(typeof(f_void_ptr))
icxx"""
typedef void (*fptr)();
fptr f_fun_ptr = reinterpret_cast<fptr>($f_void_ptr2);
evaluatec(f_fun_ptr);
"""
end
f() = println("hi")
evaluate(f)
g() = print("ho")
evaluate(g)
works under 1.0.2