use v5.10; use Inline 'C'; say "At least we have compiled a bit of C code!"; my $ret= "HD3"; my $output = enctypex_msname("HD2", undef); say "Output from enctypex_msname() call: '$output', \$ret is '$ret'"; =OUTPUT CASE 1: with: my $output = enctypex_msname("HD2", "asdf"); At least we have compiled a bit of C code! Output from enctypex_msname() call: 'HD2', $ret is 'HD3' HD2 asdf name 0000000002D2BC58 retname 0000000002D2BB68 CASE 2: my $output = enctypex_msname("HD2", undef); At least we have compiled a bit of C code! Output from enctypex_msname() call: 'HD2', $ret is 'HD3' HD2 (null) name 0000000002C93298 retname 0000000000000000 =cut __END__ __C__ unsigned char *enctypex_msname(char *name, SV* retname) { char * retname_string = SvPOK(retname) ? SvPV_nolen(retname) : NULL; printf ("%s %s\n",name,retname_string); printf ("%s %p %s %p\n", "name ",name, "retname ",retname_string); return name; }