From c48b76837523515394075db5288081b9c789aab5 Mon Sep 17 00:00:00 2001
From: Stephen Bennett <sbennett@accelrys.com>
Date: Tue, 16 Mar 2010 18:08:13 +0000
Subject: [PATCH 3/3] Add an x64 platform to the API_test project, and an x64 build of the
 DLL. Use it in tests where appropriate.

---
 API_test64.dll           |  Bin 0 -> 71680 bytes
 Test.pm                  |    6 +
 api-test/API_test.sln    |    8 ++-
 api-test/API_test.suo    |  Bin 7680 -> 8192 bytes
 api-test/API_test.vcproj |  232 +++++++++++++++++++++++++++++++++++++++++++++-
 t/00_API.t               |    3 +-
 t/01_Struct.t            |    3 +-
 7 files changed, 248 insertions(+), 4 deletions(-)
 create mode 100755 API_test64.dll

diff --git a/API_test64.dll b/API_test64.dll
new file mode 100755
index 0000000000000000000000000000000000000000..e8cb055c8bd7e136c755d2918b41c0a6335a609c
GIT binary patch
diff --git a/Test.pm b/Test.pm
index 2365ac8..5f72479 100755
--- a/Test.pm
+++ b/Test.pm
@@ -7,6 +7,12 @@
 
 package Win32::API::Test;
 
+sub is_perl_64bit () {
+    use Config;
+    return 1 if $Config{archname} =~ /x64/;
+}
+
+
 sub compiler_name () {
 	use Config;
 	my $cc = $Config{ccname};
diff --git a/api-test/API_test.sln b/api-test/API_test.sln
index f21116c..d2e0022 100755
--- a/api-test/API_test.sln
+++ b/api-test/API_test.sln
@@ -1,18 +1,24 @@
 ﻿
 Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual C++ Express 2008
+# Visual Studio 2008
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "API_test", "API_test.vcproj", "{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Debug|Win32.ActiveCfg = Debug|Win32
 		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Debug|Win32.Build.0 = Debug|Win32
+		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Debug|x64.ActiveCfg = Debug|x64
+		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Debug|x64.Build.0 = Debug|x64
 		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Release|Win32.ActiveCfg = Release|Win32
 		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Release|Win32.Build.0 = Release|Win32
+		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Release|x64.ActiveCfg = Release|x64
+		{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
diff --git a/api-test/API_test.suo b/api-test/API_test.suo
index d7f2c75c0495abcdba0d8ce7946555acb68d5bdc..e1b49c48c78c8c40f955c1296a16a025da3b1b6f 100755
GIT binary patch
diff --git a/api-test/API_test.vcproj b/api-test/API_test.vcproj
index abd45c9..dc358fc 100755
--- a/api-test/API_test.vcproj
+++ b/api-test/API_test.vcproj
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
 	ProjectType="Visual C++"
-	Version="9,00"
+	Version="9.00"
 	Name="API_test"
 	ProjectGUID="{DB35FD31-F92D-4A13-A382-0CD3C6A78F5B}"
 	TargetFrameworkVersion="0"
@@ -10,6 +10,9 @@
 		<Platform
 			Name="Win32"
 		/>
+		<Platform
+			Name="x64"
+		/>
 	</Platforms>
 	<ToolFiles>
 	</ToolFiles>
@@ -207,6 +210,199 @@
 				CommandLine="copy Release\API_Test.dll .."
 			/>
 		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="_DEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/API_test.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;API_TEST_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderThrough="stdafx.h"
+				PrecompiledHeaderFile=".\Debug/API_test.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile=".\Debug/API_test.dll"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile=".\API_test.def"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/API_test.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\Debug/API_test.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Debug/API_test.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				PreprocessorDefinitions="NDEBUG"
+				MkTypLibCompatible="true"
+				SuppressStartupBanner="true"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/API_test.tlb"
+				HeaderFileName=""
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				InlineFunctionExpansion="1"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;API_TEST_EXPORTS"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderThrough="stdafx.h"
+				PrecompiledHeaderFile=".\Release/API_test.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile=".\Release/API_test.dll"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ModuleDefinitionFile=".\API_test.def"
+				ProgramDatabaseFile=".\Release/API_test.pdb"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				ImportLibrary=".\Release/API_test.lib"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+				SuppressStartupBanner="true"
+				OutputFile=".\Release/API_test.bsc"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				Description="Move DLL into place"
+				CommandLine="copy Release\API_Test.dll .."
+			/>
+		</Configuration>
 	</Configurations>
 	<References>
 	</References>
@@ -234,6 +430,22 @@
 						PreprocessorDefinitions=""
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions=""
+					/>
+				</FileConfiguration>
 			</File>
 			<File
 				RelativePath="API_test.def"
@@ -260,6 +472,24 @@
 						UsePrecompiledHeader="1"
 					/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions=""
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|x64"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						PreprocessorDefinitions=""
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
 			</File>
 		</Filter>
 		<Filter
diff --git a/t/00_API.t b/t/00_API.t
index 2a156a5..4c328bb 100755
--- a/t/00_API.t
+++ b/t/00_API.t
@@ -23,7 +23,8 @@ $^E = 0;
 # On cygwin, $$ is different from Win32 process id
 my $cygwin = $^O eq 'cygwin';
 
-$test_dll = Win32::API::Test::find_test_dll('API_test.dll');
+my $test_dll_name = Win32::API::Test::is_perl_64bit() ? 'API_test64.dll' : 'API_test.dll';
+$test_dll = Win32::API::Test::find_test_dll($test_dll_name);
 diag('API_Test.dll found at ('.$test_dll.')');
 ok(-e $test_dll, 'found API_Test.dll');
 
diff --git a/t/01_Struct.t b/t/01_Struct.t
index 8667392..6e418cc 100755
--- a/t/01_Struct.t
+++ b/t/01_Struct.t
@@ -21,7 +21,8 @@ use_ok('Win32::API::Test');
 
 ok(1, 'loaded');
 
-$test_dll = Win32::API::Test::find_test_dll('API_test.dll');
+my $test_dll_name = Win32::API::Test::is_perl_64bit() ? 'API_test64.dll' : 'API_test.dll';
+$test_dll = Win32::API::Test::find_test_dll($test_dll_name);
 ok(-s $test_dll, 'found API_Test.dll');
 
 typedef Win32::API::Struct('simple_struct', qw(
-- 
1.7.0.2.276.g60daf

