Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

My c code has stopped working: PL_errgv NULL?

0 views
Skip to first unread message

Georgios Petasis

unread,
Jul 1, 2008, 10:15:48 AM7/1/08
to
Hi all,

I have some code like the following:

char *code = "some perl code";
eval_pv(code, 0);
if (SvTRUE(ERRSV)) {
// Get the error...
msg = SvPV_nolen(ERRSV);
}

This code works wit 5.8, but now that I have upgraded to 5.10
(ActivePerl) it crashes. The problem seems to be that PL_errgv
is NULL. How can I fix my code to not crash?

George

Leon Timmermans

unread,
Jul 1, 2008, 10:54:48 AM7/1/08
to
On Tue, 01 Jul 2008 17:15:48 +0300, Georgios Petasis wrote:

> This code works wit 5.8, but now that I have upgraded to 5.10
> (ActivePerl) it crashes. The problem seems to be that PL_errgv is NULL.
> How can I fix my code to not crash?

Are you absolutely sure of that? PL_errgv being NULL is highly unlikely.
Can you printf("PL_errgv = %p\n", PL_errgv) first? Are you sure you're
not linking wrongly? (e.g. including headers from one version but linking
against the library of another, that would cause these kinds of
problems).

Regards,

Leon

Georgios Petasis

unread,
Jul 1, 2008, 10:58:04 AM7/1/08
to Leon Timmermans
O/H Leon Timmermans έγραψε:

I have installed ActivePerl 5.10.0 (only) in my system.

And yes, PL_errgv is NULL. I have printed it, as I get a crash when it
was used :-(

Loading dll...
perl::interp new..
PL_errgv: 00000000
executing command!
done!

Regards,

George

Georgios Petasis

unread,
Jul 1, 2008, 11:12:11 AM7/1/08
to
O/H Georgios Petasis έγραψε:

In general, what is the suggested way to eval a script from C, and get
the error message if there is an error during execution?

George

Leon Timmermans

unread,
Jul 1, 2008, 11:50:23 AM7/1/08
to
On Tue, 01 Jul 2008 17:58:04 +0300, Georgios Petasis wrote:

> O/H Leon Timmermans έγραψε:


>
> I have installed ActivePerl 5.10.0 (only) in my system.
>
> And yes, PL_errgv is NULL. I have printed it, as I get a crash when it
> was used :-(
>
> Loading dll...
> perl::interp new..
> PL_errgv: 00000000
> executing command!
> done!
>
> Regards,
>
> George

Hi George,

Can you show me the code you use to initialize the interpreter? In
particular: does it include a call to perl_parse()? Also, you said "I
have some code like the following": Does this *exact* code also give
exactly this error?

Regards,

Leon

Georgios Petasis

unread,
Jul 1, 2008, 12:13:43 PM7/1/08
to Leon Timmermans
O/H Leon Timmermans έγραψε:


Dear Leon,

You can find the complete code at:
http://ellogon.svn.sourceforge.net/viewvc/ellogon/trunk/lib/tclperl-3.2/tclperl.c?revision=1&view=markup

Yes, I am using perl_parse():

PERL_SET_CONTEXT(my_perl);
perl_construct(my_perl);
perl_parse(my_perl, xs_init, 3, embedded, 0);
perl_run(my_perl);
eval_pv(code, 0);
SvTRUE(ERRSV); <- crash :-(

Regards,

George

Leon Timmermans

unread,
Jul 1, 2008, 2:45:53 PM7/1/08
to
On Tue, 01 Jul 2008 19:13:43 +0300, Georgios Petasis wrote:

> O/H Leon Timmermans έγραψε:
>
>

> Dear Leon,
>
> You can find the complete code at:
> http://ellogon.svn.sourceforge.net/viewvc/ellogon/trunk/lib/tclperl-3.2/
tclperl.c?revision=1&view=markup
>
> Yes, I am using perl_parse():
>
> PERL_SET_CONTEXT(my_perl);
> perl_construct(my_perl);
> perl_parse(my_perl, xs_init, 3, embedded, 0); perl_run(my_perl);
> eval_pv(code, 0);
> SvTRUE(ERRSV); <- crash :-(
>
> Regards,
>
> George

Hi,

Can you check the value of PL_errgv directly after perl_parse() and
perl_run() too?

Leon

Georgios Petasis

unread,
Jul 2, 2008, 6:01:36 AM7/2/08
to Leon Timmermans
O/H Leon Timmermans έγραψε:

Dear Leon,

It is always NULL:

perl::interp new...
After perl_construct: PL_errgv: 00000000
After perl_parse: PL_errgv: 00000000
After perl_run: PL_errgv: 00000000
After eval_pv: PL_errgv: 00000000

How can this be possible? Am I doing anything wrong during compilation?
(I.e. have I missed any flags? I have used the output of "perl
-MExtUtils::Embed -e ccopts" to get the flags...)

Regards,

George

Leon Timmermans

unread,
Jul 2, 2008, 7:10:54 AM7/2/08
to
On Wed, 02 Jul 2008 13:01:36 +0300, Georgios Petasis wrote:
>
> Dear Leon,
>
> It is always NULL:
>
> perl::interp new...
> After perl_construct: PL_errgv: 00000000 After perl_parse: PL_errgv:
> 00000000
> After perl_run: PL_errgv: 00000000
> After eval_pv: PL_errgv: 00000000
>
> How can this be possible? Am I doing anything wrong during compilation?
> (I.e. have I missed any flags? I have used the output of "perl
> -MExtUtils::Embed -e ccopts" to get the flags...)
>
> Regards,
>
> George

Hi,

The value should be set during perl_parse(). Can you check the return
value of it? I think it should be zero (but it isn't documented properly,
so I'm not entirely sure).

Regards,

Leon

Georgios Petasis

unread,
Jul 2, 2008, 7:37:20 AM7/2/08
to Leon Timmermans
O/H Leon Timmermans έγραψε:


It is NULL (0).

George

0 new messages