Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Just another Perl shrine
 
PerlMonks  

Problems with FREE MS VC++ tools

by JamesNC (Chaplain)
on Nov 22, 2005 at 13:37 UTC ( #510773=perlquestion: print w/ replies, xml ) Need Help??
JamesNC has asked for the wisdom of the Perl Monks concerning the following question:

My perl is ActiveState 5.8.7 build 813.
I do not encounter any issues running this code on an older version of Visual Studio C++. This problem only happens with the newer (free) enviroment ( as in there is no such thing as free beer I suspect ).
I downloaded and installed the free Visual C++ tools at: http://lab.msdn.microsoft.com/express/visualc/ and the new Platform SDK (which you need).
Then, I did a quick and dirty test.

1. h2xs -A -n myModule
2. perl Makefile.pl 3. edit myModule.xs
#include "EXTERN.h" #include "perl.h" #include "XSUB.h" int test ( int a ) { return a; } MODULE = myModule PACKAGE = myModule int test( int a )
4. nmake
(I only got 1 warning about -Gf being deprecated, so I looked up the error and changed the flag to -GF and it compiles with out error. All good so far. )
5. nmake install
6. open up the editor and write a quick script where I call the brain-dead function.
use strict; use myModule; my $var = myModule::test(123); print $var;
7. When I run the script I get a VC++ runtime error:
C:\Perl\bin\perl.exe R6034 An application has made an attempt to load the C runtime library + incorrectly.
And perl dies complaining:
Can't load 'C:/Perl/site/lib/auto/myModule/myModule.dll' for module my +Module: load_file:A dynamic link library (DLL) initialization routine failed at C:/Perl/lib/XSLoa +der.pm line 68. at C:/Perl/site/lib/myModule.pm line 31 Compilation failed in require at c:\progs\ptest.pl line 1. BEGIN failed--compilation aborted at c:\progs\ptest.pl line 1.

Question 1: Does anyone know what is broken and how to fix it?

Question 2: I can see that the -Gf flag needs to be fixed, how to I make the change so that when I use h2xs in the future that that flag is fixed?
Thanks!
JamesNC
Update and solution:
The solution is to create an XML file called perl.exe.manifest and place it in the same directory as your perl.exe and put the following contents in that file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1. +0"> <assemblyIdentity version="0.0.0.0" processorArchitecture="X86" name=" +Perl" type="win32" /> <description>Perl</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version +="8.0.50215.4631" processorArchitecture="x86" publicKeyToken="1fc8b3b +9a1e18e3b"></assemblyIdentity> </dependentAssembly> </dependency> </assembly>
Thanks to everyone who helped. Especially ++Pod Master.
JamesNC

Comment on Problems with FREE MS VC++ tools
Select or Download Code
Re: Problems with FREE MS VC++ tools
by Corion (Pope) on Nov 22, 2005 at 13:42 UTC

    My guess is that ActiveState built your Perl with MSVC6 and the free MSVC tools are MSVC7. The two are not binary compatible. I recommend using the same C compiler for building Perl and all Perl extensions.

    If you want to compile your own extensions you will thus have to compile your own Perl as well, which also means that you can't use any premade PPMs anymore.

      Actually, the c runtime should always be compatible. Apparently R6034 means the that perl.exe is missing a perl.exe.manifest file, a new feature of XP (starting with msvcr80). So, all he has to do is add a perl.exe.manifest, something like
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion=" +1.0"> <assemblyIdentity processorArchitecture="x86" version="5.1.0.0" type="win32" name="Controls" /> <description>Super wxPerl Application</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86" /> </dependentAssembly> </dependency> </assembly>
      I'm actually suprised this is the first time he's encountered such an error message.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

        Thanks ++, I created a perl.exe.manifest and put it in the perl bin directory with the changes for my dll minus the publicKeyToken and now the error I get "Access denied", in fact, I can't even run perl unless I remove my entry for the dll.
        Update: see above, solution found
Re: Problems with FREE MS VC++ tools
by gawatkins (Monsignor) on Nov 22, 2005 at 15:30 UTC

    The -Gf flag issue can be fixed by modifying the \lib\config_heavy.pl for version 5.8.7. Simply search for the switch, it is in there twice. Keep in mind this will be overwritten when install a new version of Perl.

    Thank you,
    Greg W
      Thanks Greg!
Re: Problems with FREE MS VC++ tools
by BrimBorium (Friar) on Aug 30, 2010 at 20:13 UTC
      patch makefile as in Re^4: Missing bufferoverflowU.lib

      To avoid having to patch the generated Makefile every time you build a module, you could fix the offending code in your perl/lib/ExtUtils/MM_Unix.pm.
      Just search that file for $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest and replace it with the correct rendition.

      Cheers,
      Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://510773]
Approved by Corion
Front-paged by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-04-21 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (493 votes), past polls