This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 866255a1208051ff89ff5544b2367955012929ad
Author: Peter Kovacs <[email protected]>
AuthorDate: Tue Jul 21 12:14:41 2026 +0200

    build/win64: x64 C++/UNO bridge (mscx_uno) + sal/salhelper x64 fixes + 
round-trip test [P3]
    
    Builds the x64 C++/UNO ABI bridge and the fixes needed to link sal/salhelper
    for x64, plus a runtime test proving the bridge marshals a call.
    
    - bridges: new mscx_uno target (target_compatible_with x86_64) using the
      msvc_win64_x86-64 platform layer — call.asm via ml64, abi.cxx, 
cpp2uno/uno2cpp,
      except.cxx (x64 SEH) — with CPPU_ENV=mscx and mscx_uno.def (same 3 
undecorated
      C exports as msci_uno.def, arch-neutral).  msci_uno is now x86-only (its 
inline
      __asm can't compile on x64).  The x64 bridge sets 
WINVER/_WIN32_WINNT=0x0600
      (its cpp2uno.cxx uses GetModuleHandleExW; 0x0500 is anachronistic on x64).
    - sal: on x64, uwinapi compiles only the 4 asm-free base TUs (the 
naked-__asm
      thunks need inline asm, which x64 MSVC lacks) and exports via a new 
Uwinapi64.def
      (single symbol) — mirrors the dmake makefile CPUNAME split; x86 unchanged.
    - salhelper: on x64, link with a new salhelperx64.def carrying x64 C++ name
      mangling (QEAA/PEAV/AEBV, size_t=_K), generated from the shipped 
mscx.map; x86
      keeps salhelper.def.
    - test: cppuno_roundtrip_test (gtest, both arches) maps a C++ XServiceInfo
      cpp->uno (loads the bridge DLL) and invokes a method via the uno_Interface
      dispatcher, exercising the bridge's marshalling and verifying the return.
    
    (sal/salhelper/bridges BUILD files also carry the [P2] arch-define strip.)
    
    Co-Authored-By: Claude Opus 4.8 <[email protected]>
    (cherry picked from commit bd53cdd485facd1850d0107deddb7e7b0d79955d)
---
 main/bridges/BUILD.bazel                      | 150 +++++++++++++++++++++++---
 main/bridges/test/cppuno_roundtrip_test.cxx   | 144 +++++++++++++++++++++++++
 main/bridges/util/mscx_uno.def                |   8 ++
 main/sal/BUILD.bazel                          |  53 +++++----
 main/sal/systools/win32/uwinapi/Uwinapi64.def |   2 +
 main/salhelper/BUILD.bazel                    |   9 +-
 main/salhelper/util/salhelperx64.def          |  29 +++++
 7 files changed, 360 insertions(+), 35 deletions(-)

diff --git a/main/bridges/BUILD.bazel b/main/bridges/BUILD.bazel
index d1cb669c7d..e9ed08c788 100644
--- a/main/bridges/BUILD.bazel
+++ b/main/bridges/BUILD.bazel
@@ -2,7 +2,7 @@ package(default_visibility = ["//visibility:public"])
 
 load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
 load("@rules_java//java:defs.bzl", "java_library")
-load("//build/rules:gtest_test.bzl", "staged_run_test")
+load("//build/rules:gtest_test.bzl", "gtest_test", "staged_run_test")
 
 _COPTS = [
     "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
@@ -19,7 +19,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
     # Needed by vtablefactory.cxx for the Windows code path
     "LEAK_STATIC_DATA",
@@ -27,6 +27,44 @@ _DEFINES = [
 
 _SLO_DEFINES = _DEFINES + ["SHAREDLIB", "_DLL_"]
 
+# x64 (mscx) variants — same as the x86 flags but with the msvc_win64_x86-64
+# platform include and CPPU_ENV=mscx (the x64 C++/UNO environment name).
+_COPTS_X64 = [
+    "/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
+    "/EHsc",
+    "/Dsnprintf=_snprintf",
+    "/Imain/bridges/source/cpp_uno/shared",
+    "/Imain/bridges/source/cpp_uno/msvc_win64_x86-64",
+    "/Imain/bridges/inc/pch",
+    "/wd4061", "/wd4127",
+]
+
+_DEFINES_X64 = [
+    "WNT", "GUI", "WIN32",
+    # Vista (0x0600) floor: x64 Windows is Vista+ (Win2000's 0x0500 is
+    # anachronistic on x64), and the trunk x64 cpp2uno.cxx calls 
GetModuleHandleExW
+    # (XP+/0x0501).  x86 keeps 0x0500 for legacy support; this is x64-only.
+    "WINVER=0x0600", "_WIN32_WINNT=0x0600", "_WIN32_IE=0x0600",
+    "CPPU_ENV=mscx",
+    "FULL_DESK",
+    "LEAK_STATIC_DATA",
+]
+
+_SLO_DEFINES_X64 = _DEFINES_X64 + ["SHAREDLIB", "_DLL_"]
+
+# Platform-neutral bridge sources shared by the x86 (msci) and x64 (mscx) DLLs.
+_BRIDGE_SHARED_SRCS = [
+    "source/cpp_uno/shared/bridge.cxx",
+    "source/cpp_uno/shared/component.cxx",
+    "source/cpp_uno/shared/component.hxx",
+    "source/cpp_uno/shared/cppinterfaceproxy.cxx",
+    "source/cpp_uno/shared/guardedarray.hxx",
+    "source/cpp_uno/shared/types.cxx",
+    "source/cpp_uno/shared/unointerfaceproxy.cxx",
+    "source/cpp_uno/shared/vtablefactory.cxx",
+    "source/cpp_uno/shared/vtables.cxx",
+]
+
 # ── Public headers ────────────────────────────────────────────────
 cc_library(
     name = "bridges_headers",
@@ -46,18 +84,8 @@ cc_library(
 # Sources: platform-neutral shared/ layer + msvc_win32_intel/ platform layer.
 cc_binary(
     name = "msci_uno",
-    srcs = [
-        # Shared (platform-neutral) sources
-        "source/cpp_uno/shared/bridge.cxx",
-        "source/cpp_uno/shared/component.cxx",
-        "source/cpp_uno/shared/component.hxx",
-        "source/cpp_uno/shared/cppinterfaceproxy.cxx",
-        "source/cpp_uno/shared/guardedarray.hxx",
-        "source/cpp_uno/shared/types.cxx",
-        "source/cpp_uno/shared/unointerfaceproxy.cxx",
-        "source/cpp_uno/shared/vtablefactory.cxx",
-        "source/cpp_uno/shared/vtables.cxx",
-        # Windows MSVC x86 platform sources
+    srcs = _BRIDGE_SHARED_SRCS + [
+        # Windows MSVC x86 platform sources (inline __asm; no call.asm/abi.cxx)
         "source/cpp_uno/msvc_win32_intel/cpp2uno.cxx",
         "source/cpp_uno/msvc_win32_intel/dllinit.cxx",
         "source/cpp_uno/msvc_win32_intel/except.cxx",
@@ -83,6 +111,8 @@ cc_binary(
         "$(execpath //main/sal:sal_implib)",
         "$(execpath //main/cppu:cppu3_implib)",
     ],
+    # x86 bridge: inline __asm doesn't compile on x64 — build only for x86.
+    target_compatible_with = ["@platforms//cpu:x86_32"],
     visibility = ["//visibility:public"],
 )
 
@@ -93,6 +123,55 @@ filegroup(
     visibility = ["//visibility:public"],
 )
 
+# ── mscx_uno.dll ─────────────────────────────────────────────────
+# Windows MSVC x64 C++/UNO bridge.  Loaded at runtime as "mscx_uno.dll"
+# (CPPU_ENV=mscx).  Uses the msvc_win64_x86-64/ platform layer: no inline 
__asm —
+# the vtable-slot trampoline is call.asm (ml64) with abi.cxx doing the x64 
calling-
+# convention argument marshalling; except.cxx handles x64 SEH→UNO exception 
mapping.
+cc_binary(
+    name = "mscx_uno",
+    srcs = _BRIDGE_SHARED_SRCS + [
+        # Windows MSVC x64 platform sources
+        "source/cpp_uno/msvc_win64_x86-64/abi.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/abi.hxx",
+        "source/cpp_uno/msvc_win64_x86-64/call.asm",
+        "source/cpp_uno/msvc_win64_x86-64/cpp2uno.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/dllinit.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/except.cxx",
+        "source/cpp_uno/msvc_win64_x86-64/mscx.hxx",
+        "source/cpp_uno/msvc_win64_x86-64/uno2cpp.cxx",
+    ],
+    copts = _COPTS_X64,
+    defines = _SLO_DEFINES_X64,
+    deps = [
+        ":bridges_headers",
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/udkapi:udkapi_idl_headers",
+        "//main/stlport:stlport",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/cppu:cppu3_implib",
+    ],
+    linkshared = True,
+    win_def_file = "util/mscx_uno.def",
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+    ],
+    # x64-only bridge.
+    target_compatible_with = ["@platforms//cpu:x86_64"],
+    visibility = ["//visibility:public"],
+)
+
+filegroup(
+    name = "mscx_uno_implib",
+    srcs = [":mscx_uno"],
+    output_group = "interface_library",
+    visibility = ["//visibility:public"],
+)
+
 # ── java_uno bridge (Java↔C++ UNO bridge) ────────────────────────────────
 # Two cooperating artifacts:
 #   • java_uno.dll  — native JNI bridge (this cc_binary)
@@ -302,3 +381,46 @@ staged_run_test(
         "//main/cppu:cppu3",
     ],
 )
+
+# ── C++/UNO bridge round-trip test ───────────────────────────────
+# Maps a C++ object cpp->uno->cpp (which loads the bridge DLL) and calls 
methods
+# through the doubly-mapped proxy, exercising the bridge's asm trampoline +
+# argument/return marshalling in both directions at run time.  Arch-agnostic: 
the
+# bridge runtime dep select()s msci_uno (x86) / mscx_uno (x64), and the 
compiled
+# CPPU_ENV (msci/mscx) makes the mapping load the matching DLL — so this runs 
on
+# both arches.
+gtest_test(
+    name = "cppuno_roundtrip_test",
+    srcs = ["test/cppuno_roundtrip_test.cxx"],
+    copts = _TEST_COPTS,
+    defines = select({
+        "//build:arch_x64": _DEFINES_X64,
+        "//conditions:default": _DEFINES,
+    }),
+    deps = [
+        "//main/sal:sal_headers",
+        "//main/cppu:cppu_headers",
+        "//main/cppuhelper:cppuhelper_headers",
+        "//main/udkapi:udkapi_idl_headers",
+        "//main/stlport:stlport",
+    ],
+    additional_linker_inputs = [
+        "//main/sal:sal_implib",
+        "//main/cppu:cppu3_implib",
+        "//main/cppuhelper:cppuhelper_implib",
+    ],
+    linkopts = [
+        "$(execpath //main/sal:sal_implib)",
+        "$(execpath //main/cppu:cppu3_implib)",
+        "$(execpath //main/cppuhelper:cppuhelper_implib)",
+    ],
+    runtime_dlls = [
+        "//main/sal:sal3",
+        "//main/salhelper:salhelper3MSC",
+        "//main/cppu:cppu3",
+        "//main/cppuhelper:cppuhelper3MSC",
+    ] + select({
+        "//build:arch_x64": ["//main/bridges:mscx_uno"],
+        "//conditions:default": ["//main/bridges:msci_uno"],
+    }),
+)
diff --git a/main/bridges/test/cppuno_roundtrip_test.cxx 
b/main/bridges/test/cppuno_roundtrip_test.cxx
new file mode 100644
index 0000000000..4c1133d23f
--- /dev/null
+++ b/main/bridges/test/cppuno_roundtrip_test.cxx
@@ -0,0 +1,144 @@
+/**************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ *************************************************************/
+
+// Focused C++/UNO bridge round-trip test.
+//
+// Maps a plain C++ UNO object from the C++ language-binding environment to the
+// binary UNO environment and back.  Constructing those Mappings loads the
+// C++/UNO bridge DLL — msci_uno.dll on x86, mscx_uno.dll on x64 (the name 
comes
+// from CPPU_CURRENT_LANGUAGE_BINDING_NAME).  A call on the doubly-mapped proxy
+// then traverses the full bridge path in both directions:
+//   C++ proxy vtable trampoline (call.asm) -> uno2cpp marshalling -> uno
+//   dispatch -> cpp2uno marshalling -> the original C++ object -> and the 
return
+//   value marshalled back.
+// So a green run proves the x64 bridge's asm + argument/return marshalling
+// actually work at run time, not merely that they link.
+
+#include "gtest/gtest.h"
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustring.h>
+#include <uno/environment.hxx>
+#include <uno/mapping.hxx>
+#include <uno/dispatcher.h>
+#include <uno/any2.h>
+#include <uno/lbnames.h>
+#include <typelib/typedescription.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::lang::XServiceInfo;
+
+#define OUSTR(x) OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
+
+namespace {
+
+// Minimal C++ UNO object.  XServiceInfo gives us a string return
+// (getImplementationName), a bool arg + bool return (supportsService) and a
+// sequence return (getSupportedServiceNames) — enough to exercise marshalling.
+class TestObj : public ::cppu::WeakImplHelper1< XServiceInfo >
+{
+public:
+    virtual OUString SAL_CALL getImplementationName()
+        throw (RuntimeException)
+        { return OUSTR("mscx.roundtrip.TestObj"); }
+
+    virtual sal_Bool SAL_CALL supportsService( const OUString & name )
+        throw (RuntimeException)
+        { return name.equalsAscii("Yes"); }
+
+    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+        throw (RuntimeException)
+        { Sequence< OUString > s(1); s[0] = OUSTR("svc.one"); return s; }
+};
+
+} // namespace
+
+TEST(CppUnoBridge, roundtrip)
+{
+    // These load the C++/UNO bridge DLL (<cpp-env>_uno.dll).
+    Mapping cpp2uno( Environment::getCurrent(), Environment( OUSTR(UNO_LB_UNO) 
) );
+    Mapping uno2cpp( Environment( OUSTR(UNO_LB_UNO) ), 
Environment::getCurrent() );
+    ASSERT_TRUE( cpp2uno.is() );   // null => bridge DLL failed to load
+    ASSERT_TRUE( uno2cpp.is() );
+
+    Type const & rXSI = ::getCppuType( (Reference< XServiceInfo > *)0 );
+
+    Reference< XServiceInfo > xOrig( static_cast< XServiceInfo * >( new 
TestObj ) );
+
+    // Map C++ -> UNO(binary): the bridge (mscx_uno) wraps xOrig in a 
uno_Interface
+    // whose dispatcher marshals uno-form calls into C++ calls on xOrig.
+    void * pUno = 0;
+    cpp2uno.mapInterface( &pUno, xOrig.get(), rXSI );
+    ASSERT_TRUE( pUno != 0 );
+    uno_Interface * pUnoI = static_cast< uno_Interface * >( pUno );
+
+    // Map that uno_Interface back UNO -> C++.  UNO guarantees object identity 
across
+    // a round-trip back to the SAME environment, so the bridge collapses this 
to the
+    // original C++ object (xBack == xOrig).  This is correct behaviour, and 
proves the
+    // bridge's uno->cpp mapInterface recognises its own proxies.
+    void * pCppBack = 0;
+    uno2cpp.mapInterface( &pCppBack, pUno, rXSI );
+    ASSERT_TRUE( pCppBack != 0 );
+    Reference< XServiceInfo > xBack(
+        static_cast< XServiceInfo * >( pCppBack ), SAL_NO_ACQUIRE );
+    EXPECT_EQ( xOrig.get(), xBack.get() );   // identity preserved (collapse)
+
+    // Genuine marshalled call THROUGH the bridge: invoke 
getImplementationName on the
+    // uno_Interface proxy directly (no collapse).  This runs the bridge's 
marshalling
+    // in mscx_uno.dll: unmarshal the (empty) uno arg block, call xOrig's C++ 
vtable,
+    // and marshal the OUString return back into uno form (an rtl_uString*).
+    typelib_TypeDescription * pXsiTd = 0;
+    rXSI.getDescription( &pXsiTd );
+    if ( ! pXsiTd->bComplete )
+        typelib_typedescription_complete( &pXsiTd );
+    typelib_InterfaceTypeDescription * pItd =
+        reinterpret_cast< typelib_InterfaceTypeDescription * >( pXsiTd );
+    // ppAllMembers[0..2] = XInterface (queryInterface/acquire/release);
+    // [3] = XServiceInfo::getImplementationName (first local method).
+    ASSERT_TRUE( pItd->nAllMembers > 3 );
+    typelib_TypeDescription * pMethodTd = 0;
+    typelib_typedescriptionreference_getDescription( &pMethodTd, 
pItd->ppAllMembers[3] );
+    ASSERT_TRUE( pMethodTd != 0 );
+
+    rtl_uString * pRet = 0;         // uno-form return slot for a string method
+    uno_Any exc;
+    uno_Any * pExc = &exc;
+    (*pUnoI->pDispatcher)( pUnoI, pMethodTd, &pRet, 0, &pExc );
+
+    EXPECT_TRUE( pExc == 0 );        // no exception marshalled out
+    ASSERT_TRUE( pRet != 0 );
+    OUString ret( pRet );           // acquires
+    rtl_uString_release( pRet );    // drop the dispatcher's reference
+    EXPECT_TRUE( ret.equalsAscii("mscx.roundtrip.TestObj") );
+
+    typelib_typedescription_release( pMethodTd );
+    typelib_typedescription_release( pXsiTd );
+    (*pUnoI->release)( pUnoI );
+}
+
+int main(int argc, char **argv)
+{
+    ::testing::InitGoogleTest(&argc, argv);
+    return RUN_ALL_TESTS();
+}
diff --git a/main/bridges/util/mscx_uno.def b/main/bridges/util/mscx_uno.def
new file mode 100644
index 0000000000..7ae183595a
--- /dev/null
+++ b/main/bridges/util/mscx_uno.def
@@ -0,0 +1,8 @@
+; Windows export file for mscx_uno.dll (x64 C++/UNO bridge)
+; Exports the three C-linkage entry points from 
source/cpp_uno/shared/component.cxx
+; (undecorated extern "C" names — identical on x86/x64; only the DLL name 
differs)
+LIBRARY mscx_uno
+EXPORTS
+    component_canUnload
+    uno_initEnvironment
+    uno_ext_getMapping
diff --git a/main/sal/BUILD.bazel b/main/sal/BUILD.bazel
index ae1699829d..bb7255e3a6 100644
--- a/main/sal/BUILD.bazel
+++ b/main/sal/BUILD.bazel
@@ -15,7 +15,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
@@ -107,32 +107,47 @@ cc_library(
 ## a Windows API compatibility shim
 cc_binary(
     name = "uwinapi",
-    srcs = glob(
-        [
-            "systools/win32/uwinapi/*.h",
-            "systools/win32/uwinapi/*.cpp",
-            "systools/win32/uwinapi/*.c",
-        ],
-        exclude = [
-            # function-body fragments — #include'd by other .cpp files
-            "systools/win32/uwinapi/GetLongPathName.cpp",
-            "systools/win32/uwinapi/GetUserDomain_NT.cpp",
-            "systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp",
-            # not in original makefile SLOFILES — incomplete/broken TUs 
-            "systools/win32/uwinapi/SHILCreateFromPathW.cpp",
-            "systools/win32/uwinapi/MCIWndCreateW.cpp",
-            "systools/win32/uwinapi/sntprintf.c",
+    srcs = glob(["systools/win32/uwinapi/*.h"]) + select({
+        # x64: MSVC has no inline assembler, so the naked-__asm thunk 
forwarders
+        # (IMPLEMENT_THUNK / DEFINE_*_THUNK in macros.h) don't compile.  On x64
+        # Windows every shimmed API exists natively, so — mirroring the dmake
+        # makefile.mk CPUNAME split (INTEL adds the thunks; x64 builds only the
+        # asm-free base set) — compile just the four base TUs on x64.  Exports
+        # shrink to uwinapi64.dxp's single symbol (see the Uwinapi64.def 
below).
+        "//build:arch_x64": [
+            "systools/win32/uwinapi/ResolveThunk.cpp",
+            "systools/win32/uwinapi/SHCreateItemFromParsingName.cpp",
+            "systools/win32/uwinapi/snprintf.c",
+            "systools/win32/uwinapi/snwprintf.c",
         ],
-    ),
+        "//conditions:default": glob(
+            [
+                "systools/win32/uwinapi/*.cpp",
+                "systools/win32/uwinapi/*.c",
+            ],
+            exclude = [
+                # function-body fragments — #include'd by other .cpp files
+                "systools/win32/uwinapi/GetLongPathName.cpp",
+                "systools/win32/uwinapi/GetUserDomain_NT.cpp",
+                "systools/win32/uwinapi/GetUserDomain_WINDOWS.cpp",
+                # not in original makefile SLOFILES — incomplete/broken TUs
+                "systools/win32/uwinapi/SHILCreateFromPathW.cpp",
+                "systools/win32/uwinapi/MCIWndCreateW.cpp",
+                "systools/win32/uwinapi/sntprintf.c",
+            ],
+        ),
+    }),
     linkshared = True,
     copts = _COPTS,
     defines = _DEFINES,
     deps = [":sal_headers", ":uwinapi_fragments"],
     linkopts = [
-        "/DEF:main/sal/systools/win32/uwinapi/Uwinapi.def",
         "kernel32.lib", "user32.lib", "advapi32.lib",
         "version.lib", "shlwapi.lib",
-    ],
+    ] + select({
+        "//build:arch_x64": 
["/DEF:main/sal/systools/win32/uwinapi/Uwinapi64.def"],
+        "//conditions:default": 
["/DEF:main/sal/systools/win32/uwinapi/Uwinapi.def"],
+    }),
     visibility = ["//visibility:public"],
 )
 ## final shared dll
diff --git a/main/sal/systools/win32/uwinapi/Uwinapi64.def 
b/main/sal/systools/win32/uwinapi/Uwinapi64.def
new file mode 100644
index 0000000000..bd67aecb31
--- /dev/null
+++ b/main/sal/systools/win32/uwinapi/Uwinapi64.def
@@ -0,0 +1,2 @@
+EXPORTS
+       SHCreateItemFromParsingName
diff --git a/main/salhelper/BUILD.bazel b/main/salhelper/BUILD.bazel
index a13e093c35..b9770a4d30 100644
--- a/main/salhelper/BUILD.bazel
+++ b/main/salhelper/BUILD.bazel
@@ -12,7 +12,7 @@ _COPTS = [
 _DEFINES = [
     "WNT", "GUI", "WIN32", "_MT",
     "WINVER=0x0500", "_WIN32_WINNT=0x0500", "_WIN32_IE=0x0500",
-    "CPPU_ENV=msci", "INTEL", "_X86_=1",
+    "CPPU_ENV=msci", 
     "FULL_DESK",
 ]
 
@@ -43,7 +43,12 @@ cc_binary(
     ],
     additional_linker_inputs = ["//main/sal:sal_implib"],
     linkshared = True,
-    win_def_file = "util/salhelper.def",
+    # x64 uses a .def with x64 C++ name mangling (mscx.map: __cdecl __ptr64
+    # QEAA/PEAV/AEBV, size_t=_K), vs x86's __thiscall QAE/AAV (msci.map).
+    win_def_file = select({
+        "//build:arch_x64": "util/salhelperx64.def",
+        "//conditions:default": "util/salhelper.def",
+    }),
     linkopts = [
         "$(execpath //main/sal:sal_implib)",
     ],
diff --git a/main/salhelper/util/salhelperx64.def 
b/main/salhelper/util/salhelperx64.def
new file mode 100644
index 0000000000..8100a06ecb
--- /dev/null
+++ b/main/salhelper/util/salhelperx64.def
@@ -0,0 +1,29 @@
+; Windows export file for salhelper3MSC.dll (x64 / mscx)
+; Derived from salhelper/source/mscx.map (all global: sections)
+; GetVersionInfo excluded (build-system artifact, not in source)
+LIBRARY salhelper3MSC
+EXPORTS
+    ??0ORealDynamicLoader@salhelper@@IEAA@PEAPEAV01@AEBVOUString@rtl@@1PEAX2@Z
+    ??1ORealDynamicLoader@salhelper@@MEAA@XZ
+    ??_7ORealDynamicLoader@salhelper@@6B@
+    ?acquire@ORealDynamicLoader@salhelper@@QEAAKXZ
+    ?getApi@ORealDynamicLoader@salhelper@@QEBAPEAXXZ
+    
?newInstance@ORealDynamicLoader@salhelper@@SAPEAV12@PEAPEAV12@AEBVOUString@rtl@@1@Z
+    ?release@ORealDynamicLoader@salhelper@@QEAAKXZ
+    ??1SimpleReferenceObject@salhelper@@MEAA@XZ
+    ??2SimpleReferenceObject@salhelper@@SAPEAX_K@Z
+    ??2SimpleReferenceObject@salhelper@@SAPEAX_KAEBUnothrow_t@std@@@Z
+    ??3SimpleReferenceObject@salhelper@@SAXPEAX@Z
+    ??3SimpleReferenceObject@salhelper@@SAXPEAXAEBUnothrow_t@std@@@Z
+    ??_7SimpleReferenceObject@salhelper@@6B@
+    ??0Condition@salhelper@@QEAA@AEAVMutex@osl@@@Z
+    ??1Condition@salhelper@@UEAA@XZ
+    ??0ConditionModifier@salhelper@@QEAA@AEAVCondition@1@@Z
+    ??1ConditionModifier@salhelper@@QEAA@XZ
+    ??0ConditionWaiter@salhelper@@QEAA@AEAVCondition@1@@Z
+    ??0ConditionWaiter@salhelper@@QEAA@AEAVCondition@1@K@Z
+    ??1ConditionWaiter@salhelper@@QEAA@XZ
+    ??0timedout@ConditionWaiter@salhelper@@QEAA@XZ
+    ??0timedout@ConditionWaiter@salhelper@@QEAA@AEBU012@@Z
+    ??1timedout@ConditionWaiter@salhelper@@UEAA@XZ
+    ??4timedout@ConditionWaiter@salhelper@@QEAAAEAU012@AEBU012@@Z

Reply via email to