http://www.perlmonks.org?node_id=824725

bbrownlee has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys.

I have a problem that I think is related to Win32::OLE and Perl versioning. I am migrating an app from one server to another one and the darn thing just isn't cooperating. The app is called Numara Footprints and runs on Perl, which is distributed with the app itself; hence, changing the version of Perl is probably not a viable option since it will void our support contract with Numara.

  • The old system runs Activestate Perl v5.8.8 built for MSWin32-x86-multi-thread
  • The new system runs Activestate Perl v5.10.0 built for MSWin32-x64-multi-thread
  • Both servers are the same OS, Windows Server 2008, 64 bit standard.

    I execute the following lines to invoke a dll and output an error if one exists:

    $tdc = Win32::OLE->new('TDapiole80.TDconnection'); print Win32::OLE->LastError();

    Invoking the object/method on the old system outputs no errors. But on the new system, I get the following:

    Win32::OLE(0.1709) error 0x80040154: "Class not registered"

    Now, I have seen some discussions about the class not registered issue being related to not loading a dll properly into the system's registry. But I have done this due diligence and assure you the dll is registered. This is why I believe the issue is related to the perl versions and their respective behaviors through the Win32::OLE module.

    Please help, Oh Great Perl Monks!

    Thanks in advance for your help.

    - bb

    Replies are listed 'Best First'.
    Re: Perl Version and Win32::OLE
    by Anonymous Monk on Feb 22, 2010 at 23:01 UTC
      But I have done this due diligence and assure you the dll is registered. This is why I believe the issue is related to the perl versions and their respective behaviors through the Win32::OLE module.

      You're wrong. Error 0x80040154: Class Not Registered

        I have verified that both servers have identical registry entries for the dlls in question, which is why I am noodling this forum for advice. The diffs at the system level, from what I can tell, are limited to perl version and Win32::OLE.

          I now believe the issue is related to the 64 bit version of Perl trying to use Win32::OLE to read a 32 bit *registered* DLL, which cannot be done without some creative wrapper work. On a 64 bit OS, you can register 64 and 32 bit DLL's, but 64 bit software can't read 32 bit DLL's, even if they are registered. Here are some articles on the topic:

          http://support.microsoft.com/kb/282423

          “64-bit programs cannot load and call 32-bit MDAC”

          http://www.dnjonline.com/article.aspx?id=jun07_access3264

          “The best way to migrate such a product to a 64-bit platform is to migrate both the main module and the dependency DLL, but if the dependency DLL cannot be migrated then it cannot be loaded into the 64-bit process and the application won't work.”

          “One possible way of … is to implement a 64-bit wrapper' DLL that exposes the same functions, parameters, types and so forth as the original 32-bit DLL. This wrapper DLL can then make IPC-based calls to the original 32-bit DLL, which has been loaded into a surrogate process.”

          It's too bad that Win32::OLE, when used by a 64 bit version of Perl, apparently does not by itself act as the wrapper that performs IPC-based calls to the original 32 bit DLL. Does anyone know of a module we can use in place of Win32::OLE that can perform the appropriate translation so we can use a 32 bit DLL in a 64 bit version of Perl?