From ca15b093880f64c2f3a6ec875255d38177cad7c7 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-92MS0N6\\godunko" Date: Thu, 23 Nov 2023 08:12:52 +0300 Subject: [PATCH 1/2] Use External_Name instead of Link_Name to fix linking failure on Windows 32bit --- .../vss-implementation-windows-advapi32.ads | 4 ++-- .../vss-implementation-windows-kernel32.ads | 24 +++++++++---------- .../vss-implementation-windows-shell32.ads | 4 ++-- .../vss-implementation-windows-user32.ads | 4 ++-- .../vss-implementation-windows-userenv.ads | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/source/os/windows/vss-implementation-windows-advapi32.ads b/source/os/windows/vss-implementation-windows-advapi32.ads index 9742efd2..cd8d9f79 100644 --- a/source/os/windows/vss-implementation-windows-advapi32.ads +++ b/source/os/windows/vss-implementation-windows-advapi32.ads @@ -1,5 +1,5 @@ -- --- Copyright (C) 2022, AdaCore +-- Copyright (C) 2022-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- @@ -15,6 +15,6 @@ package VSS.Implementation.Windows.Advapi32 is DesiredAccess : DWORD; TokenHandle : out HANDLE) return BOOL - with Import, Convention => Stdcall, Link_Name => "OpenProcessToken"; + with Import, Convention => Stdcall, External_Name => "OpenProcessToken"; end VSS.Implementation.Windows.Advapi32; diff --git a/source/os/windows/vss-implementation-windows-kernel32.ads b/source/os/windows/vss-implementation-windows-kernel32.ads index bfa1bc61..d47f4e37 100644 --- a/source/os/windows/vss-implementation-windows-kernel32.ads +++ b/source/os/windows/vss-implementation-windows-kernel32.ads @@ -1,5 +1,5 @@ -- --- Copyright (C) 2022, AdaCore +-- Copyright (C) 2022-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- @@ -37,19 +37,19 @@ package VSS.Implementation.Windows.Kernel32 is STARTF_USESTDHANDLES : constant DWORD := 16#0000_0100#; function CloseHandle (hObject : HANDLE) return BOOL - with Import, Convention => Stdcall, Link_Name => "CloseHandle"; + with Import, Convention => Stdcall, External_Name => "CloseHandle"; function GetCommandLine return LPWSTR - with Import, Convention => Stdcall, Link_Name => "GetCommandLineW"; + with Import, Convention => Stdcall, External_Name => "GetCommandLineW"; function GetConsoleWindow return HWND - with Import, Convention => Stdcall, Link_Name => "GetConsoleWindow"; + with Import, Convention => Stdcall, External_Name => "GetConsoleWindow"; function GetCurrentProcess return HANDLE - with Import, Convention => Stdcall, Link_Name => "GetCurrentProcess"; + with Import, Convention => Stdcall, External_Name => "GetCurrentProcess"; function GetLastError return DWORD - with Import, Convention => Stdcall, Link_Name => "GetLastError"; + with Import, Convention => Stdcall, External_Name => "GetLastError"; function GetEnvironmentVariable (lpName : LPCWSTR; @@ -57,30 +57,30 @@ package VSS.Implementation.Windows.Kernel32 is nSize : DWORD) return DWORD with Import, Convention => Stdcall, - Link_Name => "GetEnvironmentVariableW"; + External_Name => "GetEnvironmentVariableW"; procedure GetStartupInfo (lpStartupInfo : Kernel32.LPSTARTUPINFO) - with Import, Convention => StdCall, Link_Name => "GetStartupInfoW"; + with Import, Convention => StdCall, External_Name => "GetStartupInfoW"; function GetTempPath (nBufferLength : DWORD; lpBuffer : LPWSTR) return DWORD - with Import, Convention => Stdcall, Link_Name => "GetTempPathW"; + with Import, Convention => Stdcall, External_Name => "GetTempPathW"; function GetLongPathName (lpszShortPath : LPCWSTR; lpszLongPath : LPWSTR; cchBuffer : DWORD) return DWORD - with Import, Convention => Stdcall, Link_Name => "GetLongPathNameW"; + with Import, Convention => Stdcall, External_Name => "GetLongPathNameW"; function GetModuleFileName (hModule : HANDLE; lpFilename : LPWSTR; nSize : DWORD) return DWORD - with Import, Convention => StdCall, Link_Name => "GetModuleFileNameW"; + with Import, Convention => StdCall, External_Name => "GetModuleFileNameW"; procedure LocalFree (hMem : LPWSTR_Pointer) - with Import, Convention => StdCall, Link_Name => "LocalFree"; + with Import, Convention => StdCall, External_Name => "LocalFree"; end VSS.Implementation.Windows.Kernel32; diff --git a/source/os/windows/vss-implementation-windows-shell32.ads b/source/os/windows/vss-implementation-windows-shell32.ads index b8a1a1bd..9ff15c39 100644 --- a/source/os/windows/vss-implementation-windows-shell32.ads +++ b/source/os/windows/vss-implementation-windows-shell32.ads @@ -1,5 +1,5 @@ -- --- Copyright (C) 2022, AdaCore +-- Copyright (C) 2022-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- @@ -13,6 +13,6 @@ package VSS.Implementation.Windows.Shell32 is function CommandLineToArgv (lpCmdLine : LPCWSTR; pNumArgs : out Interfaces.C.int) return LPWSTR_Pointer - with Import, Convention => Stdcall, Link_Name => "CommandLineToArgvW"; + with Import, Convention => Stdcall, External_Name => "CommandLineToArgvW"; end VSS.Implementation.Windows.Shell32; diff --git a/source/os/windows/vss-implementation-windows-user32.ads b/source/os/windows/vss-implementation-windows-user32.ads index 5dc9a1f1..2dd9676a 100644 --- a/source/os/windows/vss-implementation-windows-user32.ads +++ b/source/os/windows/vss-implementation-windows-user32.ads @@ -1,5 +1,5 @@ -- --- Copyright (C) 2022, AdaCore +-- Copyright (C) 2022-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- @@ -21,6 +21,6 @@ package VSS.Implementation.Windows.User32 is lpText : LPCWSTR; lpCaption : LPCWSTR; uType : UINT) return Interfaces.C.int - with Import, Convention => StdCall, Link_Name => "MessageBoxW"; + with Import, Convention => StdCall, External_Name => "MessageBoxW"; end VSS.Implementation.Windows.User32; diff --git a/source/os/windows/vss-implementation-windows-userenv.ads b/source/os/windows/vss-implementation-windows-userenv.ads index f05bd900..6f3dde31 100644 --- a/source/os/windows/vss-implementation-windows-userenv.ads +++ b/source/os/windows/vss-implementation-windows-userenv.ads @@ -1,5 +1,5 @@ -- --- Copyright (C) 2022, AdaCore +-- Copyright (C) 2022-2023, AdaCore -- -- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- @@ -17,6 +17,6 @@ package VSS.Implementation.Windows.Userenv is return BOOL with Import, Convention => Stdcall, - Link_Name => "GetUserProfileDirectoryW"; + External_Name => "GetUserProfileDirectoryW"; end VSS.Implementation.Windows.Userenv; From 77cc26f63c808b45b8b30e0570a2a55669c289f2 Mon Sep 17 00:00:00 2001 From: "U-DESKTOP-92MS0N6\\godunko" Date: Thu, 23 Nov 2023 08:25:00 +0300 Subject: [PATCH 2/2] Clarify use of duplicate -luserenv switch. --- gnat/vss_text.gpr | 1 + 1 file changed, 1 insertion(+) diff --git a/gnat/vss_text.gpr b/gnat/vss_text.gpr index 9bbc5c51..ed8f874a 100644 --- a/gnat/vss_text.gpr +++ b/gnat/vss_text.gpr @@ -32,6 +32,7 @@ library project VSS_Text is case VSS_Common.Library_Kind is when "relocatable" => OS_Library_Options := ("-luserenv"); + -- `userenv` has been added explicitly to fix link failure. when others=> null; end case;