NIM SDK API  9.0.0
nim_sdk_cpp_wrapper.h
Go to the documentation of this file.
1 
6 #ifndef NIM_SDK_CPP_WRAPPER_DLL_H_
7 #define NIM_SDK_CPP_WRAPPER_DLL_H_
8 // 下列 ifdef 块是创建使从 DLL 导出更简单的
9 // 宏的标准方法。此 DLL 中的所有文件都是用命令行上定义的 NIM_SDK_CPPWRAPPER_EXPORTS
10 // 符号编译的。在使用此 DLL 的
11 // 任何其他项目上不应定义此符号。这样,源文件中包含此文件的任何其他项目都会将
12 // NIM_SDK_CPPWRAPPER_DLL_API 函数视为是从 DLL 导入的,而此 DLL 则将用此宏定义的
13 // 符号视为是被导出的。
14 
15 #ifdef CPPWRAPPER_DLL
16 
17 #if defined(WIN32)
18 
19 // for Windows
20 #if defined(NIM_SDK_CPPWRAPPER_EXPORTS)
21 #define NIM_SDK_CPPWRAPPER_DLL_API __declspec(dllexport)
22 #else
23 #define NIM_SDK_CPPWRAPPER_DLL_API __declspec(dllimport)
24 #endif
25 
26 #else // WIN32
27 
28 // for macOS
29 #if defined(NIM_SDK_CPPWRAPPER_EXPORTS)
30 #define NIM_SDK_CPPWRAPPER_DLL_API __attribute__((visibility("default")))
31 #else
32 #define NIM_SDK_CPPWRAPPER_DLL_API
33 #endif
34 
35 #endif // WIN32
36 
37 #else
38 #define NIM_SDK_CPPWRAPPER_DLL_API
39 #endif
40 #endif