LIEF: Library to Instrument Executable Formats Version 2.0.0
Loading...
Searching...
No Matches
visibility.h
Go to the documentation of this file.
1/* Copyright 2017 - 2026 R. Thomas
2 *
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 LIEF_SYMBOL_VISIBILITY_H
17#define LIEF_SYMBOL_VISIBILITY_H
18
20
21/* Thanks to
22 * https://github.com/aguinet/dragonffi/blob/40f3fecb9530a2ef840f63882c5284ea5e8dc9e8/include/dffi/exports.h
23 */
24#if defined _WIN32 || defined __CYGWIN__
25 #define LIEF_HELPER_IMPORT __declspec(dllimport)
26 #define LIEF_HELPER_EXPORT __declspec(dllexport)
27 #define LIEF_HELPER_LOCAL
28#else
29 #define LIEF_HELPER_IMPORT __attribute__((visibility("default")))
30 #define LIEF_HELPER_EXPORT __attribute__((visibility("default")))
31 #define LIEF_HELPER_LOCAL __attribute__((visibility("hidden")))
32#endif
33
34#if defined(LIEF_STATIC)
35 #define LIEF_API
36 #define LIEF_LOCAL
37#elif defined(LIEF_EXPORTS)
38 #define LIEF_API LIEF_HELPER_EXPORT
39 #define LIEF_LOCAL LIEF_HELPER_LOCAL
40#elif defined(LIEF_IMPORT)
41 #define LIEF_API LIEF_HELPER_IMPORT
42 #define LIEF_LOCAL LIEF_HELPER_LOCAL
43#else
44 #define LIEF_API
45 #define LIEF_LOCAL LIEF_HELPER_LOCAL
46#endif
47
48#endif