1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NAPI_ARK_INTEROP_MACRO_H 17 #define NAPI_ARK_INTEROP_MACRO_H 18 19 #ifdef __cplusplus 20 #define DECL_START extern "C" { 21 #define DECL_END } 22 #else 23 #define DECL_START 24 #define DECL_END 25 #endif 26 27 #ifndef EXPORT 28 #ifdef __WINDOWS__ 29 #define EXPORT __declspec(dllexport) 30 #else 31 #define EXPORT __attribute__((visibility("default"))) 32 #endif 33 #endif 34 35 #ifdef CLANG_COVERAGE 36 #ifdef __WINDOWS__ 37 #define COV_EXPORT __declspec(dllexport) 38 #else // __WINDOWS__ 39 #define COV_EXPORT __attribute__((visibility("default"))) 40 #endif // __WINDOWS__ 41 #else // COV_EXPORT 42 #define COV_EXPORT 43 #endif // COV_EXPORT 44 45 // can not quote 'TYPE' in 'TYPE*', be careful on usage 46 #define BIT_CAST(VALUE, TYPE) (*reinterpret_cast<TYPE*>(&(VALUE))) 47 #define P_CAST(VALUE, TYPE) (reinterpret_cast<TYPE>(VALUE)) 48 49 #define ARKTS_INLINE inline __attribute__((always_inline)) 50 51 #endif // NAPI_ARK_INTEROP_MACRO_H 52