1 /*========================== begin_copyright_notice ============================ 2 3 Copyright (C) 2017-2021 Intel Corporation 4 5 SPDX-License-Identifier: MIT 6 7 ============================= end_copyright_notice ===========================*/ 8 9 #pragma once 10 11 #if defined(_WIN32) 12 #define CREATE_CIF_MAIN_CALLING_CONV __cdecl 13 #if defined(CIF_EXPORT) 14 #define CREATE_CIF_MAIN_API __declspec(dllexport) 15 #else 16 #define CREATE_CIF_MAIN_API __declspec(dllimport) 17 #endif 18 #else 19 #define CREATE_CIF_MAIN_CALLING_CONV 20 #define CREATE_CIF_MAIN_API __attribute__((visibility("default"))) 21 #endif 22 23 #define EXPORTED_FUNC_NAME CIFCreateMain 24 25 namespace CIF { 26 struct CIFMain; 27 using CreateCIFMainFunc_t = CIF::CIFMain *(CREATE_CIF_MAIN_CALLING_CONV *)(); 28 #define STR2(X) #X 29 #define STR(X) STR2(X) 30 static const char * const CreateCIFMainFuncName = STR(EXPORTED_FUNC_NAME); 31 #undef STR 32 #undef STR2 33 } 34 35 #ifdef CIF_EXPORT 36 CIF::CIFMain *CreateCIFMainImpl(); 37 #endif 38 39 extern "C" { 40 // entry point to shared object (dynamic library) 41 // the only function that gets exported explicitly 42 #if defined CIF_EXPORT EXPORTED_FUNC_NAME()43CREATE_CIF_MAIN_API void *CREATE_CIF_MAIN_CALLING_CONV EXPORTED_FUNC_NAME() { 44 return CreateCIFMainImpl(); 45 } 46 #endif 47 } 48 49 #undef CIF_MAIN_EXPORT_FUNC_NAME 50 51 #undef CREATE_CIF_MAIN_API 52 #undef CREATE_CIF_MAIN_CALLING_CONV 53