diff --git a/platforms/posix/src/px4/windows/tests/test_windows_shim_runtime.cpp b/platforms/posix/src/px4/windows/tests/test_windows_shim_runtime.cpp index a49d69b8cf..ee5337fcf3 100644 --- a/platforms/posix/src/px4/windows/tests/test_windows_shim_runtime.cpp +++ b/platforms/posix/src/px4/windows/tests/test_windows_shim_runtime.cpp @@ -58,7 +58,18 @@ #include #include +/* The runtime shim references g_px4_session_id (defined in + * platforms/posix/src/px4/windows/runtime/init.cpp). This test binary + * does not link init.cpp because pulling it in drags the entire process + * bootstrap. Provide a local definition that mirrors the runtime + * contract. The original is C++-linkage (no extern "C") in init.cpp so + * we match that here exactly. */ +volatile LONG g_px4_session_id = 0; + #include +#include +#include +#include #include #include #include @@ -70,10 +81,12 @@ /* errno_map prototypes -- declared in px4_windows_internal.h but the * tests don't include that header (it pulls in the entire winsock+win32 - * stack via the shim umbrella). Forward-declare just what we need. */ -extern "C" int px4_win_error_to_errno(DWORD err); -extern "C" int px4_wsa_error_to_errno(int err); -extern "C" const char *px4_hstrerror_text(int err); + * stack via the shim umbrella). Forward-declare just what we need. The + * originals are C++-linkage in errno_map.cpp; matching the linkage + * exactly here keeps name mangling aligned. */ +int px4_win_error_to_errno(DWORD err); +int px4_wsa_error_to_errno(int err); +const char *px4_hstrerror_text(int err); /* errno_map ------------------------------------------------------------ */