routine(a, b=4,...) char * a; int b PREINIT: foo_t * c = NULL; CODE: if (items > 2 ) { if (SvOK(ST(2))) { /* defined */ if (SvROK(ST(2))) { /* reference */ IV tmp = SvIV((SV*)SvRV(ST(2))); c = INT2PTR(foo_t *,tmp); } else Perl_croak(aTHX_ "c is not a reference"); } } ... continuing as before