[OpenLayers-Dev] Manifests and DLLs and Microsoft screwups

Jeff Dege jdege at korterra.com
Tue Apr 17 18:10:42 EDT 2007

As we're all painfully aware, Microsoft added a new concept with VS 2005
- the manifest.

This is a chunck of XML that describes exactly what dependencies a given
executable has.

The manifest can be included as a resource within an executable or DLL,
or it can be a separate file - foo.exe.manifest or bar.dll.manifest.

If an executable has both an internal and an external manifest, on
Windows XP the internal manifest is ignored and the external manifest
used, on Windows 2003 the external manifest is used and the internal
manifest is used.

Additionally, when DLLs are loaded through LoadLibrary() calls, external
manifests cannot be loaded.  So you have to have added the manifest to
the DLL.  Which Microsoft's linkers do not do by default.

There may be some setting in the VS 2005 IDE to include the manifest in
the DLL file.  I haven't hunted that out.  But to build a DLL from the
commandline, and include the manifest in it:

REM set the environment variables
call "e:\tools\Microsoft Visual Studio 8\Vc\vcvarsall.bat"

REM build the DLL
cl /LD /MD foo.c

REM add the manifest
mt -outputresource:foo.dll;#2 -manifest foo.dll.manifest

More information about the Dev mailing list