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 (C) 2011-2023 KiCad Developers, see change_log.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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef IMPORT_EXPORT_H_
26#define IMPORT_EXPORT_H_
27
30
31#if defined(_WIN32)
32 #define APIEXPORT __declspec(dllexport)
33 #define APIIMPORT __declspec(dllimport)
34 #define APILOCAL
35#elif defined(__GNUC__) && __GNUC__ >= 4
36 // On ELF, we compile with hidden visibility, so unwrap that for specific symbols:
37 #define APIEXPORT __attribute__ ((visibility("default")))
38 #define APIIMPORT __attribute__ ((visibility("default")))
39 #define APILOCAL __attribute__ ((visibility("hidden")))
40#else
41 #pragma message ( "warning: a supported C++ compiler is required" )
42 #define APIEXPORT
43 #define APIIMPORT
44 #define APILOCAL
45#endif
46
47// We use APIVISIBLE to mark extern template declarations where we cannot use APIEXPORT
48// Because MSVC disallows mixing dllexport and extern templates, we can't just use APIEXPORT
49// However MSVC is fine with the dllexport in the cpp file and extern in the header
50// But we need the visibility declared on both instantiation and extern for GCC/Clang to make
51// the symbol visible
52#if defined( __GNUC__ ) || defined( __clang__ )
53 #define APIVISIBLE __attribute__ ((visibility("default")))
54#else
55 #define APIVISIBLE
56#endif
57
58#if defined(COMPILING_DLL)
59 #define KIFACE_API APIEXPORT
60#else
61 #define KIFACE_API APIIMPORT
62#endif
63
64#define KIFACE_LOCAL APILOCAL
65
66#endif // IMPORT_EXPORT_H_