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

In reply to Problems with FREE MS VC++ tools by JamesNC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.