From c588569857e818040a862dcb612898f8a2003a56 Mon Sep 17 00:00:00 2001 From: Sainan Date: Fri, 25 Oct 2024 11:16:42 +0200 Subject: [PATCH] Ensure plugin.h uses C ABI when used via C++ (#83) --- includes/plugin.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/includes/plugin.h b/includes/plugin.h index 41646a3..b7a1d3a 100644 --- a/includes/plugin.h +++ b/includes/plugin.h @@ -5,14 +5,20 @@ #if defined(_WIN32) || defined(WIN32) #ifdef ANALOGSDK_EXPORTS -#define ANALOGSDK_API __declspec(dllexport) +#define ANALOGSDK_EXPORT __declspec(dllexport) #else -#define ANALOGSDK_API __declspec(dllimport) +#define ANALOGSDK_EXPORT __declspec(dllimport) #endif #pragma comment(lib, "userenv.lib") #pragma comment(lib, "WS2_32") #else -#define ANALOGSDK_API +#define ANALOGSDK_EXPORT +#endif + +#ifdef __cplusplus +#define ANALOGSDK_API extern "C" ANALOGSDK_EXPORT +#else +#define ANALOGSDK_API ANALOGSDK_EXPORT #endif const uint32_t ANALOG_SDK_PLUGIN_ABI_VERSION = 1;