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(TYPE) extern "C" TYPE
15  #define INFERENCE_ENGINE_API_CPP(type) type
16  #define INFERENCE_ENGINE_API_CLASS(type) type
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(type) extern "C" __declspec(dllexport) type __cdecl
24  #define INFERENCE_ENGINE_API_CPP(type) __declspec(dllexport) type __cdecl
25  #define INFERENCE_ENGINE_API_CLASS(type) __declspec(dllexport) type
26  #else
27  #define INFERENCE_ENGINE_API(type) extern "C" __declspec(dllimport) type __cdecl
28  #define INFERENCE_ENGINE_API_CPP(type) __declspec(dllimport) type __cdecl
29  #define INFERENCE_ENGINE_API_CLASS(type) __declspec(dllimport) type
30  #endif
31  #else
32  #define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
33  #ifdef IMPLEMENT_INFERENCE_ENGINE_API
34  #define INFERENCE_ENGINE_API(type) extern "C" __attribute__((visibility("default"))) type
35  #define INFERENCE_ENGINE_API_CPP(type) __attribute__((visibility("default"))) type
36  #define INFERENCE_ENGINE_API_CLASS(type) __attribute__((visibility("default"))) type
37  #else
38  #define INFERENCE_ENGINE_API(type) extern "C" type
39  #define INFERENCE_ENGINE_API_CPP(type) type
40  #define INFERENCE_ENGINE_API_CLASS(type) type
41  #endif
42  #endif
43 #endif
44 
45 #if defined(_WIN32)
46  #define INFERENCE_ENGINE_DEPRECATED __declspec(deprecated)
47 #else
48  #define INFERENCE_ENGINE_DEPRECATED __attribute__((deprecated))
49 #endif
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 #ifdef _MSC_VER
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(__clang__) || ((__GNUC__) && (__GNUC__*100 + __GNUC_MINOR__ > 405))
66 #define IE_SUPPRESS_DEPRECATED_START \
67  IE_DO_PRAGMA(GCC diagnostic push) \
68  IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
69 #define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
70 #else
71 #define IE_SUPPRESS_DEPRECATED_START
72 #define IE_SUPPRESS_DEPRECATED_END
73 #endif
header file for no_copy class