char *foo = SvPV( RETVAL, 0 ); fcn( foo ); printf( "string: %s length: %d", foo, strlen(foo) ); #### #!/usr/bin/perl -w use Inline C; svfunc(); __END__ __C__ void svfunc( ) { SV *val; STRLEN x; char *ptr; ptr = malloc( 5 ); memset( ptr, 0, 5); memset( ptr, 65, 4 ); val = newSVpv( ptr, 20 ); ptr = SvPV( val, x ); printf( "String is %s with len of %d (%d)\n", ptr, x, strlen(ptr) ); }