Jan Dubois wrote:
On Thu, 21 Jun 2007, Steve Hay wrote:
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.

Yes, that is correct.  You should also redefine boot_Win32CORE from

    XS(boot_Win32CORE)

to

    void boot_Win32CORE(pTHX)

and get rid of the dXSARGS. Call it with an aTHX instead.

I tried tidying up the previous patch to leave stuff in init_os_extras() and provide a -DPERL_MINIPERL (at least on Win32, not sure about how to do it for Cygwin) and started running into warnings and errors about duplicate declarations of boot_Win32CORE(), which eventually led me to realize that it is also being handled somehow in perllib.c (with the aid of perllibst.h).

The latter file is written at build-time and by default contains entries for the single default static extension, Win32CORE:

#ifdef STATIC1
    "Win32CORE",
#undef STATIC1
#endif
#ifdef STATIC2
    EXTERN_C void boot_Win32CORE (pTHX_ CV* cv);
#undef STATIC2
#endif
#ifdef STATIC3
    newXS("Win32CORE::bootstrap", boot_Win32CORE, file);
#undef STATIC3
#endif

That newXS() call ends up getting run from the xs_init() function in win32/perllib.c, which then made me think that we don't need to be booting Win32CORE from init_os_extras() anyway because it's already being done in xs_init().

So I hoped that the attached (much simpler) patch we solve the problem, but alas, I now find that, e.g. installperl doesn't run, complaining that &Win32::CopyFile is not defined.

Use of Win32::CopyFile() works if Win32 has been explicitly loaded by a "use" statement in the program, but that shouldn't be necessary.

What am I missing here? Should the newXS() call in perllib.c be sufficient, but is just defective in some way, or do we need something in init_os_extras() as well (or instead)? It doesn't seem right that we have what looks like a similar thing being in two different places. Maybe they're actually different in some way that I haven't appreciated yet?

--
==== //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);
 }
 

Reply via email to