NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_sdk_cpp_wrapper.h
浏览该文件的文档.
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
41
42#ifdef __clang__
43#if __has_extension(attribute_deprecated_with_message)
44#define NIMCPP_DEPRECATED(message) __attribute__((deprecated(message)))
45#endif
46#elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc)
47#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
48#define NIMCPP_DEPRECATED(message) __attribute__((deprecated(message)))
49#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
50#define NIMCPP_DEPRECATED(message) __attribute__((__deprecated__))
51#endif // GNUC version
52#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates
53 // MSVC)
54#define NIMCPP_DEPRECATED(message) __declspec(deprecated(message))
55#endif // __clang__ || __GNUC__ || _MSC_VER
56
57#if !defined(NIMCPP_DEPRECATED)
58#define NIMCPP_DEPRECATED(message)
59#endif // if !defined(NIMCPP_DEPRECATED)