Steve Hay wrote:
Jan Dubois wrote:
Sorry, I have no idea what is going on. From looking at the Perl
sources, I get a bad vibe from the call_sv() inside Perl_init_os_extras()
in win32/win32.c. The Perl interpreter isn't fully initialized when
this function is called, so it is not clear to me that it is really
safe to use the Perl calling mechanism yet.
Just as an experiment, you could replace the whole block
/* load Win32 CORE stubs, assuming Win32CORE was statically linked */
if ((cv = get_cv("Win32CORE::bootstrap", 0))) {
dSP;
PUSHMARK(SP);
(void)call_sv((SV *)cv, G_EVAL|G_DISCARD|G_VOID);
}
with just a call to boot_Win32CORE() (and add the appropriate EXTERN
definition too), just to see if this makes the error go away.
I haven't got very far trying this yet. I've changed it to:
void boot_Win32CORE(CV* cv);
void
Perl_init_os_extras(void)
{
dTHX;
char *file = __FILE__;
CV *cv;
dXSUB_SYS;
boot_Win32CORE(cv);
newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file);
}
for the perl.exe build (miniperl.exe unsurprisingly doesn't like that!),
but now I get an access violation when running perl.exe (even just -e "1"):
I've got around that by removing the XSRETURN_YES from the end of
boot_Win32CORE(), which probably makes sense given that I declared it as
"void" above.
I now find that PAR-Packer builds and tests OK. So perhaps we need
something like the attached patch in blead?
The one thing that I'm not sure of, though, is how to tell when we're
building as part of miniperle.exe. In the patch I've tested for
PERL_DEBUGGING_MSTATS, which is just one perl.exe build option that I
happen to be using that doesn't get used when building miniperl.exe. Is
there a #define that identifies miniperl.exe compilation, or do we need
to add one?
--
==== //depot/perl/cygwin/cygwin.c#15 - c:\p5p\bleadperl\cygwin\cygwin.c ====
@@ -197,16 +197,9 @@
init_os_extras(void)
{
char *file = __FILE__;
- CV *cv;
dTHX;
newXS("Cwd::cwd", Cygwin_cwd, file);
newXS("Cygwin::winpid_to_pid", XS_Cygwin_winpid_to_pid, file);
newXS("Cygwin::pid_to_winpid", XS_Cygwin_pid_to_winpid, file);
-
- if ((cv = get_cv("Win32CORE::bootstrap", 0))) {
- dSP;
- PUSHMARK(SP);
- (void)call_sv((SV *)cv, G_EVAL|G_DISCARD|G_VOID);
- }
}
==== //depot/perl/ext/Win32CORE/Win32CORE.c#3 -
c:\p5p\bleadperl\ext\Win32CORE\Win32CORE.c ====
@@ -82,6 +82,4 @@
newXS("Win32::CopyFile", w32_CopyFile, file);
newXS("Win32::Sleep", w32_Sleep, file);
/* newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file); */
-
- XSRETURN_YES;
}
==== //depot/perl/ext/Win32CORE/Win32CORE.pm#2 -
c:\p5p\bleadperl\ext\Win32CORE\Win32CORE.pm ====
@@ -1,6 +1,6 @@
package Win32CORE;
-$VERSION = '0.01';
+$VERSION = '0.02';
use strict;
use warnings;
==== //depot/perl/perl.c#814 - c:\p5p\bleadperl\perl.c ====
@@ -2162,6 +2162,10 @@
if (xsinit)
(*xsinit)(aTHX); /* in case linked C routines want magical
variables */
#ifndef PERL_MICRO
+#if defined(PERL_DEBUGGING_MSTATS) && (defined(WIN32) || defined(__CYGWIN__))
+ /* load Win32 CORE stubs, assuming Win32CORE was statically linked */
+ boot_Win32CORE();
+#endif
#if defined(VMS) || defined(WIN32) || defined(DJGPP) || defined(__CYGWIN__) ||
defined(EPOC) || defined(SYMBIAN)
init_os_extras();
#endif
==== //depot/perl/win32/win32.c#290 - c:\p5p\bleadperl\win32\win32.c ====
@@ -4582,16 +4582,6 @@
{
dTHX;
char *file = __FILE__;
- CV *cv;
- dXSUB_SYS;
-
- /* load Win32 CORE stubs, assuming Win32CORE was statically linked */
- if ((cv = get_cv("Win32CORE::bootstrap", 0))) {
- dSP;
- PUSHMARK(SP);
- (void)call_sv((SV *)cv, G_EVAL|G_DISCARD|G_VOID);
- }
-
newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file);
}