From beae14cddfb981d0ea168fc71bfb9847276f2301 Mon Sep 17 00:00:00 2001 From: fsfod Date: Thu, 18 Jan 2024 20:07:32 +0000 Subject: [PATCH] Fix TestSharedLib not exporting ret_zero on windows --- unittests/CppInterOp/TestSharedLib/TestSharedLib.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unittests/CppInterOp/TestSharedLib/TestSharedLib.h b/unittests/CppInterOp/TestSharedLib/TestSharedLib.h index 41fe7f758..8736f64bf 100644 --- a/unittests/CppInterOp/TestSharedLib/TestSharedLib.h +++ b/unittests/CppInterOp/TestSharedLib/TestSharedLib.h @@ -1,7 +1,11 @@ #ifndef UNITTESTS_CPPINTEROP_TESTSHAREDLIB_TESTSHAREDLIB_H #define UNITTESTS_CPPINTEROP_TESTSHAREDLIB_TESTSHAREDLIB_H -// Avoid having to mangle/demangle the symbol name in tests. -extern "C" int ret_zero(); +// Avoid having to mangle/demangle the symbol name in tests +#ifdef WIN32 + extern "C" __declspec(dllexport) int ret_zero(); +#else + extern "C" int ret_zero(); +#endif #endif // UNITTESTS_CPPINTEROP_TESTSHAREDLIB_TESTSHAREDLIB_H