On Fri, 22 Jun 2007, Steve Hay wrote:
> 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().
xs_init() only defines Win32CORE::bootstrap, but doesn't call it. When
you run "use Win32CORE" DynaLoader would find this function and call it.
Again, you should not use call_sv() from xs_init() because it is called
around the same time as init_os_extras, before the interpreter is fully
initialized, so don't be tempted to move the old code from init_os_extras()
to xs_init().
I think it is better to call boot_Win32CORE() from init_os_extras(), unless
you can find a way to call it from xs_init() under Cygwin too.
Since boot_Win32CORE() is called without "use Win32CORE" (which is the whole
reason Win32CORE exists in the first place), there is no point in having
an entry for Win32CORE in perllibst.h. I most ways it should be treated
the same way as DynaLoader, which is also bootstrapped specially.
The existence of Win32CORE.pm is really bogus. We should rename it to
Win32CORE.pod and get rid of the executable code. There is simply no
reason to ever have a "use Win32CORE" statement in your code.
Feel free to leave this issue alone for now; I'll try to come up with a
proper patch early next week. But let me know if you continue to hack
on it so that we don't duplicate the effort.
Cheers,
-Jan
PS: I wonder if this discussion wouldn't be more appropriate on P5P instead.
It is a core Perl issue, not a PAR problem.