Hi , I am using a sample code provided in C for embedding perl interpreter
/////////////////////////////////////////// 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.
Best Regards
Manoj

In reply to SvTRUE(ERRSV) crsahes in Perl 5.10 by mcaisuca

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.