1 /* 2 * Copyright (C) 2024 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 #pragma once 18 19 // libbinder is built with symbol hidden by default. To add a new symbol to the 20 // ABI, you must annotate it with this LIBBINDER_EXPORTED macro. When not 21 // building libbinder (e.g. when another binary includes a libbinder header), 22 // this macro is a no-op. 23 // 24 // Examples: 25 // 26 // // Export a function. 27 // LIBBINDER_EXPORTED void someFunction(); 28 // 29 // // Export a subset of the symbols for a class. 30 // class SomeClassA { 31 // public: 32 // LIBBINDER_EXPORTED SomeClassA(); 33 // 34 // LIBBINDER_EXPORTED SomeMethod(); 35 // } 36 // 37 // // Export all the symbols for a class, even private symbols. 38 // class LIBBINDER_EXPORTED SomeClassB {}; 39 // 40 // For a more detailed explanation of this strategy, see 41 // https://www.gnu.org/software/gnulib/manual/html_node/Exported-Symbols-of-Shared-Libraries.html 42 #if BUILDING_LIBBINDER 43 #define LIBBINDER_EXPORTED __attribute__((__visibility__("default"))) 44 #else 45 #define LIBBINDER_EXPORTED 46 #endif 47 48 // For stuff that is exported but probably shouldn't be. It behaves the exact 49 // same way as LIBBINDER_EXPORTED, only exists to help track what we want 50 // eventually remove. 51 // 52 // Needed, at least in part, because the test binaries are using internal 53 // headers and accessing these symbols directly. 54 #define LIBBINDER_INTERNAL_EXPORTED LIBBINDER_EXPORTED 55