From 8ba18777f35447f7c23f5f4af9fa59ebba4798c1 Mon Sep 17 00:00:00 2001 From: "Henrique A. Klein" Date: Tue, 20 Aug 2024 11:20:18 -0300 Subject: [PATCH] Fix: Visibility and extern fixed for Windows --- src/GeniusSDK.cpp | 4 ++-- src/GeniusSDK.h | 20 +++++++++----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/GeniusSDK.cpp b/src/GeniusSDK.cpp index d5ac116..b895eff 100644 --- a/src/GeniusSDK.cpp +++ b/src/GeniusSDK.cpp @@ -81,7 +81,7 @@ static outcome::result ReadDevConfigFromJSON( const std std::shared_ptr GeniusNodeInstance; -GNUS_VISIBILITY_DEFAULT GNUS_EXPORT const char *GeniusSDKInit( const char *base_path ) +const char *GeniusSDKInit( const char *base_path ) { std::string path = ""; if ( base_path != nullptr ) @@ -104,7 +104,7 @@ GNUS_VISIBILITY_DEFAULT GNUS_EXPORT const char *GeniusSDKInit( const char *base_ return ret_val.c_str(); } -GNUS_VISIBILITY_DEFAULT GNUS_EXPORT void GeniusSDKProcess( const ImagePath_t path, const PayAmount_t amount ) +void GeniusSDKProcess( const ImagePath_t path, const PayAmount_t amount ) { GeniusNodeInstance->ProcessImage( std::string{ path }, amount ); } diff --git a/src/GeniusSDK.h b/src/GeniusSDK.h index a378964..200b33d 100644 --- a/src/GeniusSDK.h +++ b/src/GeniusSDK.h @@ -9,8 +9,11 @@ #include -#ifndef GNUS_EXPORT -#define GNUS_EXPORT extern "C" +#ifndef GNUS_EXPORT_BEGIN + #if defined(__cplusplus) + #define GNUS_EXPORT_BEGIN extern "C" { + #define GNUS_EXPORT_END } + #endif #endif #ifdef _WIN32 @@ -19,19 +22,14 @@ #define GNUS_VISIBILITY_DEFAULT __attribute__( ( visibility( "default" ) ) ) #endif -#ifndef __cplusplus -extern "C" -{ -#endif +GNUS_EXPORT_BEGIN typedef char ImagePath_t[1024]; ///< ID/Path of the image to be processed typedef uint64_t PayAmount_t; ///< Amount to be paid for the processing -#ifndef __cplusplus -} -#endif +GNUS_VISIBILITY_DEFAULT const char *GeniusSDKInit( const char *base_path ); +GNUS_VISIBILITY_DEFAULT void GeniusSDKProcess( const ImagePath_t path, const PayAmount_t amount ); -GNUS_VISIBILITY_DEFAULT GNUS_EXPORT const char *GeniusSDKInit( const char *base_path ); -GNUS_VISIBILITY_DEFAULT GNUS_EXPORT void GeniusSDKProcess( const ImagePath_t path, const PayAmount_t amount ); +GNUS_EXPORT_END #endif //GENIUSSDK_H