in .swg %typemap(in) void (* cb)(void *) { $1 = INT2PTR($1_ltype, SvUV($input)); printf(":: x%x to x%x\n", (unsigned long long)SvUV($input), $1); if(SvGMAGICAL($input)) mg_get($input); $1 = DPTR2FPTR($1_ltype, SvUV($input)); printf("::DPTR2FPTR x%x to x%x\n", SvIV($input), $1); }