libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Embedding manifests in DLLs


From: Christopher Hulbert
Subject: Embedding manifests in DLLs
Date: Mon, 29 Mar 2010 13:12:17 -0400

I am working on a patch for my windows branch of libtool that will
allow me to embed manifest files in the DLLs. I have been manually
embedding them for a while now using "mt -manifest libfoo.dll.manifest
-outputresource:libfoo.dll;#2". Growing tired of that and the
occasional error if I forget to do that, I finally put in a little
time to add what I need into libtool. Since a patch would be relative
to my windows branch, I'll just describe the changes below. I am just
hoping to get some feedback from others who are working with manifest
files since the topic was recently active on the list.

libltdl/m4/libtool.m4 was modified as follows:
1. add the LT_PATH_MT function to look for MS's manifest tool program.
This sets the Libtool variable MANIFEST_TOOL to the program found.
+# LT_PATH_MT
+# ----------
+# find the pathname to the MS Manifest Tool
+AC_DEFUN([LT_PATH_MT],
+[
+    # Check for Microsoft Manifest Tool
+    AC_CHECK_TOOL(MT, mt,)
+    _LT_DECL([MANIFEST_TOOL], [MT], [0], [MS Manifest Tool])dnl
+]) # LT_PATH_MT

2. Add a call to the LT_PATH_MT function added in _LT_SETUP.


Also, libltdl/config/ltmain.m4sh was modified as follows:
1. Add -embed-manifest and -manifest-resource-id options to
func_mode_link. The first option tells libtool to embed the manifest
file if it exists, and the second takes an argument that is the
manifest id. The way it works out, is I need resource id 2 for my DLLs
to work.
2. In func_mode_link, after the test whether to create links to the
real library, the code block below was added. I am not sure if this is
the exact correct place for it, but it seems to work and
func_mode_link is VERY long. embed_manifest is a variable set to yes
when '-embed-manifest' is given as an argument, and
manifest_resource_id is the argument given by the
'manifest-resource-id'. Right now, I am passing a little more than
just the resource id (e.g. I'm passing ';#2' instead of just '2'), but
I will probably clean it up before I commit it. So from the makefile
perspective, I am now passing "-embed-manifest -manifest-resource-id
';\#2'" to my AM_LDFLAGS to get it passed to libtool. I've tested and
this seems to work with the Intel C++ compilers on Windows. I haven't
yet checked the MSVC or PGI compilers.

+   if test "$embed_manifest" = "yes" && test -n "$MANIFEST_TOOL"; then
+       if test -e "${output_objdir}/${realname}.manifest"; then
+       func_show_eval '$MANIFEST_TOOL -manifest
"${output_objdir}/${realname}.manifest"
-outputresource:"${output_objdir}/${realname}${manifest_resource_id}"'
+       fi
+   fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]