On 09/12/06, Jan Dubois <[EMAIL PROTECTED]> wrote:
>I just started with Win32 to make sure everything still works after the
>move.  It is not done yet; I plan to do the following additional steps:
>
>1) Move the remaining Win32::* functions from win32/win32.c into
>   ext/Win32/Win32.xs and just add forwarding stubs to win32/win32.c
>   that will "require Win32" and then call the function in Win32.xs.

It turned out that this move was not as easy as expected.  The problems
fall into 2 areas:

1) miniperl can no longer use Win32::* functions because it cannot load
   Win32.dll.

2) Some tests fail because they change the working directory, so loading
   the Win32::* functions at runtime via -I../lib doesn't always work.

The changes in patch1.diff modify the build scripts, test script and
some modules used via miniperl to deal with this correctly.

patch2.diff moves the Win32::* functions into the ext/Win32 module and
adds forwarder functions to load the module at runtime on first use:

  static void
  forward(pTHX_ const char *function)
  {
      dXSARGS;
      Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvn("Win32",5), NULL);
      PUSHMARK(SP-items);
      call_pv(function, GIMME_V);
  }

  #define FORWARD(function) XS(w32_##function){ forward(aTHX_ 
"Win32::"#function); }
  FORWARD(GetCwd)
  FORWARD(SetCwd)

Thanks, patches applied as change #29509 and #29510.

Note that this also impacts those dual-lived modules:

* PathTools (BTW, any new maintainer yet?)
* ExtUtils::MM

(Further patch in this thread applied as change #29511 -- impacts Storable.)

Reply via email to