Files
openvino/inference-engine/include/ie_api.h
T

121 lines
4.2 KiB
C
Raw Normal View History

2020-02-11 22:48:49 +03:00
// Copyright (C) 2018-2020 Intel Corporation
2018-10-16 13:45:03 +03:00
// SPDX-License-Identifier: Apache-2.0
//
/**
* @brief The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS.
2020-02-11 22:48:49 +03:00
*
2018-10-16 13:45:03 +03:00
* @file ie_api.h
*/
#pragma once
2020-02-11 22:48:49 +03:00
#if defined(USE_STATIC_IE) || (defined(__GNUC__) && (__GNUC__ < 4))
2020-05-27 18:37:19 +03:00
# define INFERENCE_ENGINE_API(...) extern "C" __VA_ARGS__
# define INFERENCE_ENGINE_API_CPP(...) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __VA_ARGS__
# define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
2019-01-21 21:31:31 +03:00
#else
2020-05-27 18:37:19 +03:00
# if defined(_WIN32)
# define INFERENCE_ENGINE_CDECL
# ifdef IMPLEMENT_INFERENCE_ENGINE_API
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllexport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllexport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllexport) __VA_ARGS__
# else
# define INFERENCE_ENGINE_API(...) extern "C" __declspec(dllimport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CPP(...) __declspec(dllimport) __VA_ARGS__ __cdecl
# define INFERENCE_ENGINE_API_CLASS(...) __declspec(dllimport) __VA_ARGS__
# endif
# else
# define INFERENCE_ENGINE_CDECL __attribute__((cdecl))
# define INFERENCE_ENGINE_API(...) extern "C" __attribute__((visibility("default"))) __VA_ARGS__
# define INFERENCE_ENGINE_API_CPP(...) __attribute__((visibility("default"))) __VA_ARGS__
# define INFERENCE_ENGINE_API_CLASS(...) __attribute__((visibility("default"))) __VA_ARGS__
# endif
2018-10-16 13:45:03 +03:00
#endif
2019-08-09 19:02:42 +03:00
#if defined(_WIN32)
2020-05-27 18:37:19 +03:00
# define INFERENCE_ENGINE_DEPRECATED(msg) __declspec(deprecated(msg))
2020-02-11 22:48:49 +03:00
#elif defined __INTEL_COMPILER
2020-05-27 18:37:19 +03:00
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated(msg)))
2020-02-11 22:48:49 +03:00
#elif defined(__GNUC__)
2020-05-27 18:37:19 +03:00
# define INFERENCE_ENGINE_DEPRECATED(msg) __attribute__((deprecated((msg))))
2019-08-09 19:02:42 +03:00
#else
2020-05-27 18:37:19 +03:00
# define INFERENCE_ENGINE_DEPRECATED(msg)
2019-08-09 19:02:42 +03:00
#endif
2020-04-13 21:17:23 +03:00
#if defined IMPLEMENT_INFERENCE_ENGINE_API || defined IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define INFERENCE_ENGINE_INTERNAL(msg)
#else
# define INFERENCE_ENGINE_INTERNAL(msg) INFERENCE_ENGINE_DEPRECATED(msg)
#endif
2019-08-09 19:02:42 +03:00
// Suppress warning "-Wdeprecated-declarations" / C4996
#if defined(_MSC_VER)
2020-05-27 18:37:19 +03:00
# define IE_DO_PRAGMA(x) __pragma(x)
2019-08-09 19:02:42 +03:00
#elif defined(__GNUC__)
2020-05-27 18:37:19 +03:00
# define IE_DO_PRAGMA(x) _Pragma(#x)
2019-08-09 19:02:42 +03:00
#else
2020-05-27 18:37:19 +03:00
# define IE_DO_PRAGMA(x)
2019-08-09 19:02:42 +03:00
#endif
2020-02-11 22:48:49 +03:00
#if defined(_MSC_VER) && !defined(__clang__)
2020-05-27 18:37:19 +03:00
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 4996))
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
2019-10-04 19:26:43 +03:00
#elif defined(__INTEL_COMPILER)
2020-05-27 18:37:19 +03:00
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(warning(push)) \
IE_DO_PRAGMA(warning(disable : 1478))
IE_DO_PRAGMA(warning(disable : 1786))
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(warning(pop))
2020-02-11 22:48:49 +03:00
#elif defined(__clang__) || ((__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 405))
2020-05-27 18:37:19 +03:00
# define IE_SUPPRESS_DEPRECATED_START \
IE_DO_PRAGMA(GCC diagnostic push) \
IE_DO_PRAGMA(GCC diagnostic ignored "-Wdeprecated-declarations")
# define IE_SUPPRESS_DEPRECATED_END IE_DO_PRAGMA(GCC diagnostic pop)
2019-08-09 19:02:42 +03:00
#else
2020-05-27 18:37:19 +03:00
# define IE_SUPPRESS_DEPRECATED_START
# define IE_SUPPRESS_DEPRECATED_END
2019-08-09 19:02:42 +03:00
#endif
2019-10-04 19:26:43 +03:00
2020-04-13 21:17:23 +03:00
#ifdef _WIN32
# define IE_SUPPRESS_DEPRECATED_START_WIN IE_SUPPRESS_DEPRECATED_START
# define IE_SUPPRESS_DEPRECATED_END_WIN IE_SUPPRESS_DEPRECATED_END
#else
# define IE_SUPPRESS_DEPRECATED_START_WIN
# define IE_SUPPRESS_DEPRECATED_END_WIN
2020-02-11 22:48:49 +03:00
#endif
2020-04-13 21:17:23 +03:00
#ifndef ENABLE_UNICODE_PATH_SUPPORT
# ifdef _WIN32
# if defined __INTEL_COMPILER || defined _MSC_VER
2020-04-13 21:17:23 +03:00
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
# elif defined(__GNUC__) && (__GNUC__ > 5 || (__GNUC__ == 5 && __GNUC_MINOR__ > 2)) || defined(__clang__)
# define ENABLE_UNICODE_PATH_SUPPORT
# endif
2019-10-04 19:26:43 +03:00
#endif
2020-05-27 18:37:19 +03:00
/**
* @def INFERENCE_PLUGIN_API(type)
* @brief Defines Inference Engine Plugin API method
* @param type A plugin type
*/
#if defined(_WIN32)
# ifdef IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define INFERENCE_PLUGIN_API(type) extern "C" __declspec(dllexport) type
# else
# define INFERENCE_PLUGIN_API(type) extern "C" type
# endif
#elif (__GNUC__ >= 4) // NOLINT
# ifdef IMPLEMENT_INFERENCE_ENGINE_PLUGIN
# define INFERENCE_PLUGIN_API(type) extern "C" __attribute__((visibility("default"))) type
# else
# define INFERENCE_PLUGIN_API(type) extern "C" type
# endif
#else
# define INFERENCE_PLUGIN_API(TYPE) extern "C" TYPE
#endif