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