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

Hello,

I'm using perl 5.6.1, and I built a class in C++ which is destined to be a perl module.
I compiled it on unix with all the xs necessities, installed it and everything seems to be fine.

On windows on the other hand, I seem to be able to compile and install the exact same module,
though when I try to run it I get the error: "The application failed to start because MSVCR90.dll was not found".

I googled it a lot, i'm using Visual Studio 9.0 and I tried to compile it with Visual Studio 6.0,
this is not an option since some of my C++ code can't be compiled with older versions of VC.

Does anyone have a solution for this other than "upgrade your perl version"?

Replies are listed 'Best First'.
Re: Creating a perl module on windows
by Bloodnok (Vicar) on Nov 11, 2009 at 13:45 UTC
    ...i'm using Visual Studio 9.0 and I tried to compile it with Visual Studio 6.0, this is not an option since some of my C++ code can't be compiled with older versions of VC

    Then why did you attempt it??

    You need to decide the version with which the C++ code is compileable and stick to it - in the above you appear to have decided on V9.0 ... and then promptly deliberately broken the [your own] rule!!

    A user level that continues to overstate my experience :-))
Re: Creating a perl module on windows
by AnomalousMonk (Archbishop) on Nov 11, 2009 at 18:40 UTC
    Note that the file  MSVCR90.dll is the 'MicroSoft Visual C++ Runtime 9.0' DLL.
Re: Creating a perl module on windows
by GrandFather (Saint) on Nov 12, 2009 at 01:15 UTC

    ActiveState Perl 5.6.1 was compiled against (effectively) the Visual Studio 6.0 compiler and libraries. You can only use a version of Perl compiled using a compatible compiler and libraries to those that you wish to use to compile your XS code. Your options are to upgrade to a suitably built newer Perl, or build it yourself.


    True laziness is hard work
      Your options are to upgrade to a suitably built newer Perl, or build it yourself

      I think that if the error is "The application failed to start because MSVCR90.dll was not found", then there's a very strong chance that this can be fixed by simply placing MSVCR90.dll in the path - which is what Anonymous Monk suggested (in not so many words, of course ... as is his charter :-)

      Upgrading to a newer version of ActivePerl is unlikely to help as it, too, will have been built using MSVC++ 6.0. Nevertheless, the approach that gives best mileage is to use a compiler that uses the *same* C runtime as the compiler that built perl - which, for ActivePerl, means that you use either MSVC++ 6.0 or MinGW. With ActivePerl-5.6.1, you'll need to install ExtUtils-FakeConfig in order to use MinGW - with recent builds of ActivePerl 5.8 and 5.10 you won't need EU::FC.

      Cheers,
      Rob

        My apologies to the OP. I was under the impression that AS's 5.10 build was with a newer compiler. I've no idea where I got that from though. :(


        True laziness is hard work
Re: Creating a perl module on windows
by Anonymous Monk on Nov 11, 2009 at 13:21 UTC
    Install MSVCR90.dll