void doit(void) { dSP; char *reserved; SV *result; ENTER; SAVETMPS; PUSHMARK(SP); PUTBACK; perl_call_pv("func1", G_ARRAY); SPAGAIN; result = POPs; reserved = SvPV(result, PL_na); printf("%s\n",reserved); PUTBACK; FREETMPS; LEAVE; } int main (int argc, char *argv[], char *env) { my_perl = perl_alloc(); PERL_SYS_INIT3(&argc, &argv,&env); perl_construct(my_perl); perl_parse(my_perl, NULL,argc, argv,(char **)NULL); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; perl_run(my_perl); doit(); perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); }