MODULE = boink PACKAGE = boink char hello_new( char *woteva ) PREINIT: char *boink; CODE: printf("Boink::Malloc\n"); boink = malloc( strlen( woteva ) + 3 ); sprintf( boink, "[%s]", woteva ); printf("Boink: Returning '%s'\n", boink ); RETVAL = (int)boink; void hello_free( char *boink ) CODE: printf("Boink::Free\n"); free( boink ); #### my $mres; my $textin; my $ptr; sub hello { $textin = shift; $$ptr = boink::hello_new( $textin ); bless $ptr; $mres = $$ptr; print $mres; boink::hello_free( $ptr ); return $mres; } #### use ExtUtils::testlib; use boink; boink::hello( "testing\n" ); #### Boink::Malloc Boink: Returning '[testing ]' [testing ] Boink::Free #### Boink::Malloc Boink: Returning '[testing ]' testing Boink::Free