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