Documentation
Install OpenVINO™
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
#if defined(USE_STATIC_IE) || (defined(__GNUC__) && (__GNUC__ < 4))
13
# define INFERENCE_ENGINE_API(...) extern "C" __VA_ARGS__
14
# define INFERENCE_ENGINE_API_CPP(...) __VA_ARGS__
15
# define INFERENCE_ENGINE_API_CLASS(...) __VA_ARGS__
16
# define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
17
#else
18
# if defined(_WIN32)
19
# define INFERENCE_ENGINE_CDECL
20
# ifdef IMPLEMENT_INFERENCE_ENGINE_API
21
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllexport) __VA_ARGS__ __cdecl
22
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__ __cdecl
23
# define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllexport) __VA_ARGS__
24
# else
25
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllimport) __VA_ARGS__ __cdecl
26
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllimport) __VA_ARGS__ __cdecl
27
# define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllimport) __VA_ARGS__
28
# endif
29
# else
30
# define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
31
# define INFERENCE_ENGINE_API(...) extern "C" __attribute__((visibility("default"))) __VA_ARGS__
32
# define INFERENCE_ENGINE_API_CPP(...) __attribute__((visibility("default"))) __VA_ARGS__
33
# define INFERENCE_ENGINE_API_CLASS(...) __attribute__((visibility("default"))) __VA_ARGS__
34
# endif
35
#endif
36
37
#if defined(_WIN32)
38
# define INFERENCE_ENGINE_DEPRECATED(msg) __declspec(deprecated(msg))
39
#elif defined __INTEL_COMPILER
40
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
41
#elif defined(__GNUC__)
42
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated((msg))))
43
#else
44
# define INFERENCE_ENGINE_DEPRECATED(msg)
45
#endif
46
47
#if defined IMPLEMENT_INFERENCE_ENGINE_API || defined IMPLEMENT_INFERENCE_ENGINE_PLUGIN
48
# define INFERENCE_ENGINE_INTERNAL(msg)
49
#else
50
# define INFERENCE_ENGINE_INTERNAL(msg) INFERENCE_ENGINE_DEPRECATED(msg)
51
#endif
52
53
// Suppress warning "-Wdeprecated-declarations" / C4996
54
#if defined(_MSC_VER)
55
# define IE_DO_PRAGMA(x) __pragma(x)
56
#elif defined(__GNUC__)
57
# define IE_DO_PRAGMA(x) _Pragma(#x)
58
#else
59
# define IE_DO_PRAGMA(x)
60
#endif
61
62
#if defined(_MSC_VER) && !defined(__clang__)
63
# define IE_SUPPRESS_DEPRECATED_START \
64
IE_DO_PRAGMA(warning(push)) \
65
IE_DO_PRAGMA(warning(disable : 4996))
66
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
67
#elif defined(__INTEL_COMPILER)
68
# define IE_SUPPRESS_DEPRECATED_START \
69
IE_DO_PRAGMA(warning(push)) \
70
IE_DO_PRAGMA(warning(disable : 1478))
71
IE_DO_PRAGMA(warning(disable : 1786))
72
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
73
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
74
# define IE_SUPPRESS_DEPRECATED_START \
75
IE_DO_PRAGMA(GCC diagnostic push) \
76
IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
77
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
78
#else
79
# define IE_SUPPRESS_DEPRECATED_START
80
# define IE_SUPPRESS_DEPRECATED_END
81
#endif
82
83
#ifdef _WIN32
84
# define IE_SUPPRESS_DEPRECATED_START_WIN IE_SUPPRESS_DEPRECATED_START
85
# define IE_SUPPRESS_DEPRECATED_END_WIN IE_SUPPRESS_DEPRECATED_END
86
#else
87
# define IE_SUPPRESS_DEPRECATED_START_WIN
88
# define IE_SUPPRESS_DEPRECATED_END_WIN
89
#endif
90
91
#ifndef ENABLE_UNICODE_PATH_SUPPORT
92
# ifdef _WIN32
93
# if defined __INTEL_COMPILER || defined _MSC_VER
94
# define ENABLE_UNICODE_PATH_SUPPORT
95
# endif
96
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
97
# define ENABLE_UNICODE_PATH_SUPPORT
98
# endif
99
#endif
100
101
/**
102
* @def INFERENCE_PLUGIN_API(type)
103
* @brief Defines Inference Engine Plugin API method
104
* @param type A plugin type
105
*/
106
107
#if defined(_WIN32)
108
# ifdef IMPLEMENT_INFERENCE_ENGINE_PLUGIN
109
# define INFERENCE_PLUGIN_API(type) extern "C" __declspec(dllexport) type
110
# else
111
# define INFERENCE_PLUGIN_API(type) extern "C" type
112
# endif
113
#elif (__GNUC__ >= 4) // NOLINT
114
# ifdef IMPLEMENT_INFERENCE_ENGINE_PLUGIN
115
# define INFERENCE_PLUGIN_API(type) extern "C" __attribute__((visibility("default"))) type
116
# else
117
# define INFERENCE_PLUGIN_API(type) extern "C" type
118
# endif
119
#else
120
# define INFERENCE_PLUGIN_API(TYPE) extern "C" TYPE
121
#endif