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