mcaisuca has asked for the wisdom of the Perl Monks concerning the following question:
/////////////////////////////////////////// static void call_Subtract(a, b) int a; int b; { dSP; int count; ENTER; SAVETMPS; PUSHMARK(SP); XPUSHs(sv_2mortal(newSViv(a))); XPUSHs(sv_2mortal(newSViv(b))); PUTBACK; printf("PL_errgv2 = %p\n", PL_errgv); //count = call_pv("Subtract", G_EVAL|G_SCALAR); count = call_pv("Subtract", G_SCALAR); SPAGAIN; printf("PL_errgv3 = %p\n", PL_errgv); /* Check the eval first */ if (SvTRUE(ERRSV)) //crashes here { STRLEN n_a; printf ("Uh oh - %s\n", SvPV(ERRSV, n_a)); POPs; } /* else { if (count != 1) croak("call_Subtract: wanted 1 value from 'Subtract', g +ot %d\n", count); printf ("%d - %d = %d\n", a, b, POPi); }*/ PUTBACK; FREETMPS; LEAVE; } int main (int argc, char **argv, char **env) { char *my_argv[] = { "", "power.pl" }; PERL_SYS_INIT3(&argc,&argv,&env); my_perl = perl_alloc(); perl_construct( my_perl ); printf("PL_errgv1 = %p\n", PL_errgv); perl_parse(my_perl, NULL, 2, my_argv, (char **)NULL); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; perl_run(my_perl); call_Subtract(10,5); perl_destruct(my_perl); perl_free(my_perl); PERL_SYS_TERM(); }
I am using the VC 2005 form tetsing the code. This code works fine for Perl 5.8. But it crashes for perl 5.10.
Please help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SvTRUE(ERRSV) crsahes in Perl 5.10
by roboticus (Chancellor) on Nov 11, 2010 at 12:18 UTC | |
|
Re: SvTRUE(ERRSV) crsahes in Perl 5.10
by syphilis (Archbishop) on Nov 12, 2010 at 06:44 UTC | |
by Anonymous Monk on Nov 16, 2010 at 09:54 UTC | |
by syphilis (Archbishop) on Nov 16, 2010 at 12:14 UTC | |
by BrowserUk (Patriarch) on Nov 16, 2010 at 12:26 UTC | |
|
Re: SvTRUE(ERRSV) crsahes in Perl 5.10
by afoken (Chancellor) on Nov 11, 2010 at 15:59 UTC |