develooper Front page | perl.perl5.porters | Postings from March 2013

[perl #44051] panic: top_env from embedded perl using 'do' with unused XS calls

Thread Next
From:
bulk88 via RT
Date:
March 12, 2013 05:40
Subject:
[perl #44051] panic: top_env from embedded perl using 'do' with unused XS calls
Message ID:
rt-3.6.HEAD-28177-1363066832-205.44051-15-0@perl.org
On Mon Mar 11 21:08:22 2013, daveola wrote:
> > The crash on windows is caused by a missing (see perlembed )
> > "PERL_SYS_INIT3(&argc,&argv,&env);" and "PERL_SYS_TERM();" in main.c 
> 
> It doesn't seem that the docs really explain what PERL_SYS_INIT3 does.  
> If I don't have the env, can I supply null or perhaps a pointer to an 
> empty array of char pointers?  This code is being called from another 
> language, so we don't have a main or env in the C code.

Tried your new version. No crashes on 5.17.7. Used (win32 platform)
__________________________________________________________________

        cl -c    -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -GL -G7 -DWIN32
-D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -MD -Zi -DNDEBUG
-O1 -GL -G7 "-IC:\perl517\lib\CORE"   main.c
        link -out:main.exe  -nologo -nodefaultlib -debug -opt:ref,icf
-ltcg  -libpath:"c:\perl517\lib\CORE"  -machine:x86 main.obj
C:\perl517\lib\CORE\perl517.lib oldnames.lib kernel32.lib user32.lib
gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib 
version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
__________________________________________________________________
to compile.

Running your code unmodified gave
__________________________________________________________________
C:\Documents and Settings\Owner\Desktop\cpan libs\prtbug\bug3>main
Evaluate builtin.pl
Setup the XS routine
Call builtinInit
do script.pl
Eval returns: scriptpl and
Undefined subroutine &main::fubar0 called at builtin.pl line 5.

C:\Documents and Settings\Owner\Desktop\cpan libs\prtbug\bug3>
___________________________________________________________________

In builtin.pl you wrote "	my $ret = eval 'script.pl';" That doesn't do
what I think you think it does. You probably want a do() or a require().
The error is appropriate since script.pl was never read.

Changing the eval to a require so the line reads, "	my $ret = require
'script.pl';", gives 
____________________________________________________________________
C:\Documents and Settings\Owner\Desktop\cpan libs\prtbug\bug3>main
Evaluate builtin.pl
Setup the XS routine
Call builtinInit
do script.pl
Too many arguments for main::iout at script.pl line 5, near ""Hi")"
Compilation failed in require at builtin.pl line 3.

C:\Documents and Settings\Owner\Desktop\cpan libs\prtbug\bug3>
____________________________________________________________________
"Too many arguments for " is an error from perl prototypes system.
Looking in main.c I see "	newXSproto("iout",XS_iout,__FILE__,"");", if I
change the line to "	newXSproto("iout",XS_iout,__FILE__,NULL);" and
recompile, I get
____________________________________________________________________
C:\Documents and Settings\Owner\Desktop\cpan libs\prtbug\bug3>main
Evaluate builtin.pl
Setup the XS routine
Call builtinInit
do script.pl
Eval returns: 1 and
in fubar0
HiDone with script.pl
Done

C:\Documents and Settings\Owner\Desktop\cpan libs\prtbug\bug3>
_____________________________________________________________________

I dont see a C bug in Perl here. You used "newXSproto" and gave a
prototype. If there is a bug, it is the POD for newXSproto at
http://perldoc.perl.org/perlapi.html isnt listing a C prototype nor
describes the params that func/macro takes (I think that should be fixed).
-- 
bulk88 ~ bulk88 at hotmail.com

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=44051

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About