1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef INCLUDE_PERFETTO_PUBLIC_ABI_EXPORT_H_ 18 #define INCLUDE_PERFETTO_PUBLIC_ABI_EXPORT_H_ 19 20 #ifdef _WIN32 21 #define PERFETTO_INTERNAL_DLL_EXPORT __declspec(dllexport) 22 #define PERFETTO_INTERNAL_DLL_IMPORT __declspec(dllimport) 23 #else 24 #define PERFETTO_INTERNAL_DLL_EXPORT __attribute__((visibility("default"))) 25 #define PERFETTO_INTERNAL_DLL_IMPORT 26 #endif 27 28 // PERFETTO_SDK_EXPORT: Exports a symbol from the perfetto SDK shared library. 29 // 30 // This is controlled by two defines (that likely come from the compiler command 31 // line): 32 // * PERFETTO_SDK_DISABLE_SHLIB_EXPORT: If this is defined, no export 33 // annotations are added. This might be useful when static linking. 34 // * PERFETTO_SDK_SHLIB_IMPLEMENTATION: This must be defined when compiling the 35 // shared library itself (in order to export the symbols), but must be 36 // undefined when compiling objects that use the shared library (in order to 37 // import the symbols). 38 #if !defined(PERFETTO_SDK_DISABLE_SHLIB_EXPORT) 39 #if defined(PERFETTO_SHLIB_SDK_IMPLEMENTATION) 40 #define PERFETTO_SDK_EXPORT PERFETTO_INTERNAL_DLL_EXPORT 41 #else 42 #define PERFETTO_SDK_EXPORT PERFETTO_INTERNAL_DLL_IMPORT 43 #endif 44 #else // defined(PERFETTO_SDK_DISABLE_SHLIB_EXPORT) 45 #define PERFETTO_SDK_EXPORT 46 #endif // defined(PERFETTO_SDK_DISABLE_SHLIB_EXPORT) 47 48 #endif // INCLUDE_PERFETTO_PUBLIC_ABI_EXPORT_H_ 49