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

I have a program that statically links against perl56.lib. How can I change it so it works with ActivePerl 5.8? I could just link against perl58.lib, but I'm looking for a solution that would allow it to eventually work with any perl, without re-compiling the program.
  • Comment on How can I change program so it works with any perl version?

Replies are listed 'Best First'.
Re: How can I change program so it works with any perl version?
by Corion (Patriarch) on Feb 03, 2005 at 15:21 UTC

    As the binary API and featureset between major Perl version changes, this is not possible in general, think of the Unicode chages introduced in 5.8. In theory, this should be possible for minor Perl version changes, and in practice, this seems to hold true for the 5.8.x series save 5.8.1. In general though, you will want to either rewrite your Program in Perl, so that it runs on whatever Perl is installed, or launch Perl as a separate process, so you can run whatever Perl you need. You can also look at the various methods to package Perl - the most current version is PAR. This will put the onus of packaging the program and compiling the Perl on you, but that's the price you pay for delivering one package.

      Let me explain my situation: I have a COM dll that exposes some APIs. On top of this there is another DLL that includes a .i file that uses the COM DLL. After compiling the .i with swig results a .cxx file which is then compiled and linked to perl56.lib. This whole thing generates a DLL that can be used to access to COM APIs from perl. I was hoping I can find a way to dynamically link to perl, but can't find anything.
        This whole thing generates a DLL that can be used to access to COM APIs from perl.
        Is there a special reason why you donīt use Win32::OLE to access your DLL?

        holli, regexed monk
Re: How can I change program so it works with any perl version?
by Fletch (Bishop) on Feb 03, 2005 at 15:22 UTC

    Not that I have any clue about (what sounds like) Win32 dynamic linking, but the underlying Perl C APIs changed between 5.6 and 5.8. Generally it's not guaranteed that the C API will be binary compatible between different Perl versions. You'd be better off providing the libraries for the version you used that you know work with your app rather than trying to be (too) flexible and accommodating of what the user might have installed.