KiCad PCB EDA Suite
Loading...
Searching...
No Matches
import_export.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef IMPORT_EXPORT_H_
22#define IMPORT_EXPORT_H_
23
26
27#if defined(_WIN32)
28 #define APIEXPORT __declspec(dllexport)
29 #define APIIMPORT __declspec(dllimport)
30 #define APILOCAL
31#elif defined(__GNUC__) && __GNUC__ >= 4
32 // On ELF, we compile with hidden visibility, so unwrap that for specific symbols:
33 #define APIEXPORT __attribute__ ((visibility("default")))
34 #define APIIMPORT __attribute__ ((visibility("default")))
35 #define APILOCAL __attribute__ ((visibility("hidden")))
36#else
37 #pragma message ( "warning: a supported C++ compiler is required" )
38 #define APIEXPORT
39 #define APIIMPORT
40 #define APILOCAL
41#endif
42
43// We use APIVISIBLE to mark extern template declarations where we cannot use APIEXPORT
44// Because MSVC disallows mixing dllexport and extern templates, we can't just use APIEXPORT
45// However MSVC is fine with the dllexport in the cpp file and extern in the header
46// But we need the visibility declared on both instantiation and extern for GCC/Clang to make
47// the symbol visible
48#if defined( __GNUC__ ) || defined( __clang__ )
49 #define APIVISIBLE __attribute__ ((visibility("default")))
50#else
51 #define APIVISIBLE
52#endif
53
54#if defined(COMPILING_DLL)
55 #define KIFACE_API APIEXPORT
56#else
57 #define KIFACE_API APIIMPORT
58#endif
59
60#define KIFACE_LOCAL APILOCAL
61
62#endif // IMPORT_EXPORT_H_