use strict; use warnings; use Inline C => <<'END_C'; typedef void (*hello_func_t)(); void hola_mundo() { printf("Hola, mundo!\n"); } SV* get_hola_mundo_func_ptr() { return newSViv( PTR2IV(hola_mundo) ); } void do_hello(SV *sv_with_func_ptr) { IV temp = SvIV(sv_with_func_ptr); hello_func_t hello = INT2PTR(hello_func_t, temp); hello(); } END_C my $func_ptr = get_hola_mundo_func_ptr(); do_hello($func_ptr);