summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2016-01-20 10:38:21 -0500
committerTony Cook <tony@develop-help.com>2016-01-25 11:13:28 +1100
commit67c6176d33ade0a5f5b42c778ed3ed70afb49e81 (patch)
tree4814fd72465f81d3ab271375d5dcf57432e5e0a7 /ext
parent6f9606402d094dd61cc66ca20e1768729a7dd4cb (diff)
downloadperl-67c6176d33ade0a5f5b42c778ed3ed70afb49e81.tar.gz
XS DLLs shouldn't have comctl32.dll manifest in them, they dont link to it
The manifestdependency flag caused on VC 2005 and up for all XS DLLs to include a manifest that references common controls v6 DLL, even though nothing but perl5**.dll and perl-static.exe would ever link to comctl32.dll. VC 2005 to VC 2008 put manifests in all DLLs since those VC version's CRTs require manifests to load, all other VCs generate .rsrc section free, and manifest free, DLLs by default. The /manifestdependency flag passed to VC linker for all XS DLL, was causing 52 KB of bloat in disk size of the DLLs, and perhaps a little bit of CPU to parse the manifest XML when the XS DLL is loaded. Add a test to make sure the manifest for V6 isn't accidentally broken and V5 gets loaded instead. Note this commit leaves a little bit of unequal handling of the comctl manifest between VC and GCC builds. VC >= 2005 builds with this patch will add a manifest to perl523.dll and build helpers (not installed) perlglob.exe and generate_uudmap.exe while GCC builds only manifest perl.exe and wperl.exe. With a VC 2013 32b build, before C:\p523\src>dir /s *.dll 55 File(s) 7,858,688 bytes After C:\p523\src>dir /s *.dll 55 File(s) 7,805,440 bytes
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-APItest/APItest.xs40
-rw-r--r--ext/XS-APItest/t/win32.t7
2 files changed, 46 insertions, 1 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index 843df6f94d..e542611c4d 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -5517,7 +5517,8 @@ has_backrefs(SV *sv)
OUTPUT:
RETVAL
-#if defined(WIN32) && defined(PERL_IMPLICIT_SYS)
+#ifdef WIN32
+#ifdef PERL_IMPLICIT_SYS
const char *
PerlDir_mapA(const char *path)
@@ -5526,3 +5527,40 @@ const WCHAR *
PerlDir_mapW(const WCHAR *wpath)
#endif
+
+void
+Comctl32Version()
+ PREINIT:
+ HMODULE dll;
+ VS_FIXEDFILEINFO *info;
+ UINT len;
+ HRSRC hrsc;
+ HGLOBAL ver;
+ void * vercopy;
+ PPCODE:
+ dll = GetModuleHandle("comctl32.dll"); /* must already be in proc */
+ if(!dll)
+ croak("Comctl32Version: comctl32.dll not in process???");
+ hrsc = FindResource(dll, MAKEINTRESOURCE(VS_VERSION_INFO),
+ MAKEINTRESOURCE(VS_FILE_INFO));
+ if(!hrsc)
+ croak("Comctl32Version: comctl32.dll no version???");
+ ver = LoadResource(dll, hrsc);
+ len = SizeofResource(dll, hrsc);
+ vercopy = alloca(len);
+ memcpy(vercopy, ver, len);
+ if (VerQueryValue(vercopy, "\\", (void**)&info, &len)) {
+ int dwValueMS1 = (info->dwFileVersionMS>>16);
+ int dwValueMS2 = (info->dwFileVersionMS&0xffff);
+ int dwValueLS1 = (info->dwFileVersionLS>>16);
+ int dwValueLS2 = (info->dwFileVersionLS&0xffff);
+ EXTEND(SP, 4);
+ mPUSHi(dwValueMS1);
+ mPUSHi(dwValueMS2);
+ mPUSHi(dwValueLS1);
+ mPUSHi(dwValueLS2);
+ }
+
+#endif
+
+
diff --git a/ext/XS-APItest/t/win32.t b/ext/XS-APItest/t/win32.t
index a8905c2549..a84a778210 100644
--- a/ext/XS-APItest/t/win32.t
+++ b/ext/XS-APItest/t/win32.t
@@ -34,6 +34,13 @@ SKIP:
is(decode("UTF16-LE", $result), "$bad_drive\0",
"check bad drive $bad: (wide)");
}
+ require Win32;
+ my (undef, $major, $minor)= Win32::GetOSVersion();
+ if ($major >= 5 && $minor >= 1) { #atleast XP, 2K only has V5
+ #this is testing the current state of things, specifically manifest stuff
+ #this test can be changed if perls relationship to comctl32.dll changes
+ ok((Comctl32Version())[0] >= 6,'comctl32.dll is atleast version 6')
+ }
}
done_testing();