ie_api.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 
5 /**
6  * @brief The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS.
7  *
8  * @file ie_api.h
9  */
10 #pragma once
11 
12 #include "details/ie_no_copy.hpp"
13 
14 #if defined(USE_STATIC_IE) || (defined(__GNUC__) && (__GNUC__ < 4))
15 #define INFERENCE_ENGINE_API(...) extern "C" __VA_ARGS__
16 #define INFERENCE_ENGINE_API_CPP(...) __VA_ARGS__
17 #define INFERENCE_ENGINE_API_CLASS(...) __VA_ARGS__
18 #define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
19 #else
20 #if defined(_WIN32)
21 #define INFERENCE_ENGINE_CDECL
22 
23 #ifdef IMPLEMENT_INFERENCE_ENGINE_API
24 #define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllexport) __VA_ARGS__ __cdecl
25 #define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__ __cdecl
26 #define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllexport) __VA_ARGS__
27 #else
28 #define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllimport) __VA_ARGS__ __cdecl
29 #define INFERENCE_ENGINE_API_CPP(...) __declspec(dllimport) __VA_ARGS__ __cdecl
30 #define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllimport) __VA_ARGS__
31 #endif
32 #else
33 #define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
34 #define INFERENCE_ENGINE_API(...) extern "C" __attribute__((visibility("default"))) __VA_ARGS__
35 #define INFERENCE_ENGINE_API_CPP(...) __attribute__((visibility("default"))) __VA_ARGS__
36 #define INFERENCE_ENGINE_API_CLASS(...) __attribute__((visibility("default"))) __VA_ARGS__
37 #endif
38 #endif
39 
40 #if defined(_WIN32)
41 #define INFERENCE_ENGINE_DEPRECATED(msg) __declspec(deprecated(msg))
42 #elif defined __INTEL_COMPILER
43 #define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
44 #elif defined(__GNUC__)
45 #define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated((msg))))
46 #else
47 #define INFERENCE_ENGINE_DEPRECATED(msg)
48 #endif
49 
50 #define INFERENCE_ENGINE_NN_BUILDER_DEPRECATED \
51  INFERENCE_ENGINE_DEPRECATED("Use ngraph API. NN Builder API will be removed in 2020 R2")
52 #define INFERENCE_ENGINE_NN_BUILDER_API_CLASS(...) \
53  INFERENCE_ENGINE_NN_BUILDER_DEPRECATED \
54  INFERENCE_ENGINE_API_CLASS(__VA_ARGS__)
55 
56 // Suppress warning "-Wdeprecated-declarations" / C4996
57 #if defined(_MSC_VER)
58 #define IE_DO_PRAGMA(x) __pragma(x)
59 #elif defined(__GNUC__)
60 #define IE_DO_PRAGMA(x) _Pragma(#x)
61 #else
62 #define IE_DO_PRAGMA(x)
63 #endif
64 
65 #if defined(_MSC_VER) && !defined(__clang__)
66 #define IE_SUPPRESS_DEPRECATED_START \
67  IE_DO_PRAGMA(warning(push)) \
68  IE_DO_PRAGMA(warning(disable : 4996))
69 #define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
70 #elif defined(__INTEL_COMPILER)
71 #define IE_SUPPRESS_DEPRECATED_START \
72  IE_DO_PRAGMA(warning(push)) \
73  IE_DO_PRAGMA(warning(disable : 1478))
74 #define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
75 #elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
76 #define IE_SUPPRESS_DEPRECATED_START \
77  IE_DO_PRAGMA(GCC diagnostic push) \
78  IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
79 #define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
80 #else
81 #define IE_SUPPRESS_DEPRECATED_START
82 #define IE_SUPPRESS_DEPRECATED_END
83 #endif
84 
85 #ifndef ENABLE_UNICODE_PATH_SUPPORT
86 #if defined(_WIN32)
87 #define ENABLE_UNICODE_PATH_SUPPORT
88 #elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
89 #define ENABLE_UNICODE_PATH_SUPPORT
90 #endif
91 #endif
header file for no_copy class