On Sun, 08 Jul 2007, Mark Dootson wrote: > > so you need MSVC 6 to build XS modules, because MSVC 7/8 uses a > > different C runtime. > > I thought so too - but I use a PPM for DBD::Pg that is compiled with > MSVC 7 (so you have to have the correct MSVC7 runtime on the PATH ). > I've no desire to find out how or why this works but apparently it > does. Seems potentially nightmarish as you'd need to ensure version > compatibility for every XS that used MSVC7 runtime. I'll be sticking > with MSVC6 until ActiveState change and then use whatever they change > to. But it seems it is possible to build XS modules against ActivePerl > using MSVC7.
ActivePerl and the modules in the ActiveState PPM repository are all built using VC6, using MSVCRT.dll as the runtime. Current versions of ActivePerl seamlessly support building XS code with MinGW too: If you don't have 'cl.exe' on the path, but do have 'gcc.exe' and 'dmake.exe', then MakeMaker will automatically generate Makefile's that use that build environment. MinGW also uses MSVCRT.dll as the runtime library. It is generally not a problem to mix multiple runtime libraries in a process as long as you don't use C++ structured exception handling, and if you make sure you are using matched APIs for all RTL owned objects (you cannot use a FILE* pointer generated by one RTL with fwrite() from another, or free malloc'ed memory from one RTL through the other). Therefore your extension code compiled with VC7 will most likely work with ActivePerl if you are not using C++ exceptions. You will of course use more process memory if you use multiple RTLs, but that is not usually a problem. But you will also need to bundle a copy of MSVCR70.dll and/or MSVCR71.dll with your application if you want to distribute it via PAR/PerlApp/Perl2exe, which adds a lot of bloat to these applications. I don't think you can use VC8 with ActivePerl. MSVCR80.dll requires special assembly loading instructions in MANIFEST resource included in each .exe and .dll that want's to load them. There will be support for build *all* of Perl and modules with VC8 in Perl 5.10, but I'm not sure if it can be made a mix-and-match model like we have right now. Due to the PAR/PerlApp/Perl2exe concerns I suspect that ActivePerl will continue to be built using VC6 for the foreseeable future (and with the Platform SDK compilers for 64-bits, which again link against the 64-bit version of MSVCRT.dll and not against a compiler specific version). Cheers, -Jan
