Hi Monks,

I'm hoping maybe someone has either run into something like this before or has a suggestion. I have several C DLLs and I'm using XS to call these functions from perl. Everything was going well, functions are callable, everything works on Linux. Moving over to Windows (strawberry perl), things got crazy. The DLLs were originally created by linking against the DLL runtime library (/MD) in VS2008. This worked, but there were two little snags: 1) It requires that users install the redistributable MSVCR DLL package from Microsoft - another step that really shouldn't be necessary and 2) (the one that's more of a problem) to use the DLL you have to put a fake perl.exe.manifest file in with Perl. I've seen systems where this works like a charm, and I've also seen systems where this buggered things enormously. Also, it's hard to auto-install something like that because I dont' know what perl will be installed.

Anyway, my solution was to link against the static runtime lib (/MT), which seemed to fix things at first. However, when I compile with MakeMaker, it compiles against the DLL runtime library and there's this nice little "feature" where if you pass objects (file handles, memory etc.) to a DLL that uses a different runtime library it causes a spectacular crash. Microsoft's advice on this one is just to not do that (very helpful).

Anyway, I was wondering if anyone knew how to either get MakeMaker to compile with the static (/MT) lib or if there's a trick to putting the manifest in the perl directory so it doesn't cause bad things to happen. I tried getting makemaker to use the other library a few different ways (setting libs to use :nodefault :nosearch libcmt.lib, setting libc to libcmt.lib, adding the code from this thread http://www.perlmonks.org/?node_id=610640, manually changing the Makefile, setting makemaker to create a static lib), but nothing worked.

Any insight is appreciated.

In reply to a tale of the windows runtime libs by cfreeman

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.