syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I have a Makefile.PL that, in addition to doing the usual things, compiles 3 executables from C source files - by running system() commands. On Windows Vista64, (ActiveState build 820), when building with Visual Studio 2005 I find that in addition to building the '*.exe' (as expected), a '*.exe.manifest' is also created (which I didn't expect).

A quick and simple test case failed to re-create the problem. I'll try to come up with a proper test case tomorrow. In the meantime, is anyone here familiar with the circumstances that lead to the creation of this ridiculous file ?

As an example of what it contains, here are the contents of 'version.exe.manifest' (which, seemingly, is created when version.exe is built from version.c):
<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1. +0'> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version +='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1 +e18e3b' /> </dependentAssembly> </dependency> </assembly>
Cheers,
Rob

Replies are listed 'Best First'.
Re: Makefile.PL and *.exe.manifest
by xdg (Monsignor) on Mar 21, 2007 at 11:29 UTC

    I saw a reference to that file in reading about some Windows internals. It has to do with managing DLL hell so I think you need it, but I think normally that file gets embedded into the *.exe. If you Google for .exe.manifest, you'll see plenty about it. As to how to fix it, I couldn't tell you -- my compiler-fu isn't strong enough.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Thanks for the quick reply xdg. (I can't believe how quickly you came up with that!! Are you sure you waited until I hit the 'Create' button :-)

      I like to have 'make clean' clean up everything and I was a little concerned that adding the 3 '*.exe.manifest' files to $options{clean} would result in warnings when 'make clean' was run on platforms where those .exe.manifest files had not been built. However, afaict, I need not have worried - on the perl builds that I've so far tested, 'make clean' seems to silently ignore any directive to clean up any files that don't exist.

      I groaned at the thought of having to do something like:
      if($Config{cc} eq 'cl' && $cl_version >= $some_critical_value) {$options{clean} = 'check.exe comp.exe version.e +xe check.exe.manifest comp.exe.manifest version.exe.manifest} else {$options{clean} = 'check.exe comp.exe version.exe'}
      especially given that I don't know how to assign the appropriate value to $some_critical_value :-)

      Thanks for the pointer(s)

      Btw, the simple test case I tried was as follows:
      C:\_32>type try.c #include <stdio.h> int main() { printf("Whatever ...\n"); } C:\_32>type Makefile.PL use ExtUtils::MakeMaker; system("cl try.c");
      Running 'perl Makefile.PL' failed to create 'try.exe.manifest'. <sarcasm>And they accuse Microsoft Windows of being arcane !!!</sarcasm>

      Cheers,
      Rob
      Update: And ++ to cdarke also for the link provided. Unfortunately, I'm unable to make use of the info provided there. This is generally the case re any info provided at a web page that begins "http://msdn...". (That's probably my inadequacy ... certainly not the fault of cdarke.)
      Update: I now realise that 'cl try.c' does not result in the creation of 'try.exe.manifest', but 'cl /MD try.c' does result in the creation of 'try.exe.manifest'. (In the Makefile.PL that created the .exe.manifest files, the /MD switch was being used.)
        Thanks for the quick reply xdg. (I can't believe how quickly you came up with that!! Are you sure you waited until I hit the 'Create' button :-)

        I just spent some time yesterday trolling through MSDN and some books on Safari trying to resolve problems with 'undefined reference' messages compiling Data::Alias on Strawberry. I came across .exe.manifest in one of my Google searches so it was fresh in my mind.

        And if anyone can make sense of these 'undefined reference' problems, please let me know:

        -xdg

        Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Makefile.PL and *.exe.manifest
by cdarke (Prior) on Mar 21, 2007 at 11:29 UTC
Re: Makefile.PL and *.exe.manifest
by randyk (Parson) on Mar 21, 2007 at 15:00 UTC
    From some recent changes in Apache, it seems like a command such as
    mt -manifest $(DLL).manifest -outputresource:$(DLL);2
    for a dll $(DLL), or
    mt -manifest $(EXE).manifest -outputresource:$(EXE);1
    for an exe $(EXE) is needed after the link stage.