compiling EV: problem with win 64 and/or latest cl.exe version?

Simon simonhf at gmail.com
Mon Oct 19 03:27:12 CEST 2009


On Sun, Oct 18, 2009 at 5:58 PM, Simon <simonhf at gmail.com> wrote:
> On Tue, Oct 13, 2009 at 7:51 PM, Marc Lehmann <schmorp at schmorp.de> wrote:
>> On Tue, Oct 13, 2009 at 07:41:03PM -0700, Simon <simonhf at gmail.com> wrote:
>>> test' to work with an EV compiled with cl.exe version 7.x. However
>>> 'nmake test' with an EV compiled with cl.exe version 9.x causes a
>>> crash although compilation causes no errors or warnings. Has anybody
>>> got 'nmake test' to work with an EV compiled with cl.exe version 9.x?
>>
>> The windows compilers are not generally binary compatible with each other
>> (even when by the same vendor) - have you tried compiling with the same
>> compiler as your perl binary was compiled with?
>
> So I figured out what the problem is: The problem occurs when the
> Microsoft runtime used by Perl itself (usually msvcrt.dll and
> guarenteed to be pre-installed on all Windows installations) doesn't
> match the Microsoft runtime automatically used by more recent Visual
> Studio additions (e.g. Visual Studio C++ 2008 Express Edition only
> allows linking against msvcrt90.dll which *isn't* guarenteed to be
> pre-installed on all Windows installations). This problem has nothing
> to do with 64 bit Windows etc. Because file descriptors are not
> interchangeable between msvcrt.dll and msvcrt90.dll and EV does
> interchange file descriptors between msvcrt.dll (via Perl) and
> msvcrt90.dll (directly) then this is what causes the crash. There are
> 4 possible solutions to this problem:
> a. Compile EV with the same version of VS used to compile Perl (i.e.
> an older version of VS which links against msvcrt.dll)
> b. Re-compile Perl with the latest VS (i.e. Perl will link against
> msvcrt90.dll instead of msvcrt.dll)
> c. Figure out how to make the latest VS link against msvcrt.dll (some
> people say this is possible although difficult)
> d. Hack EV so that it doesn't pass any of it's file descriptors to
> Perl (not sure how difficult this is)
>
> This long blog article contains all the gory details:
> http://kobyk.wordpress.com/2007/07/20/dynamically-linking-with-msvcrtdll-using-visual-c-2005/
>
> Hope this helps somebody,
> Simon

BTW depends.exe shows which .dlls get loaded at runtime in a nice
tree. It clearly shows the msvcrt.dll versus msvcrt90.dll problem:
http://www.dependencywalker.com/

Perl modules which don't mix msvcrt*.dll handles compile and run just
fine against Perl even with the latest version of VC. E.g. I tried
event and Win32::API -- two modules which heavily use C and
msvcrt90.dll -- and they compile and all tests run fine even though
depends.exe shows both msvcrt.dll and msvcrt90.dll loaded at runtime.

HTH,
Simon



More information about the libev mailing list