BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
WinDllMacros.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Wrap/WinDllMacros.h
6 //! @brief Defines export/import macros for global data symbols
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2015
11 //! @authors Scientific Computing Group at MLZ Garching
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_WRAP_WINDLLMACROS_H
16 #define BORNAGAIN_WRAP_WINDLLMACROS_H
17 
18 //! @def BA_CORE_API_
19 //! @brief Macro for export/import global data symbols (Windows only).
20 //! Relevant for Windows only.
21 //! In Linux/MAC, this macro is empty.
22 //!
23 //! In principle all exports are done with "export all symbols". This is defined in
24 //! the CMake file BornAgain/Windows.cmake:
25 //! @code set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) @endcode
26 //!
27 //! However, this is not sufficient for exported data symbols, see CMake documentation:
28 //!
29 //! "[...]For global data symbols, __declspec(dllimport) must still be used when compiling
30 //! against the code in the .dll. All other function symbols will be automatically exported
31 //! and imported by callers."
32 //!
33 //! For this reason, this macro still has to exist next to the named CMake
34 //! property.
35 
36 //! @def BA_DEVICE_API_
37 //! @copydoc #BA_CORE_API_
38 
39 #ifdef _WIN32
40 
41 #ifdef BA_DEVICE_BUILD_DLL
42 #define BA_DEVICE_API_ __declspec(dllexport)
43 #else
44 #define BA_DEVICE_API_ __declspec(dllimport)
45 #endif // BA_DEVICE_BUILD_DLL
46 
47 #ifdef BA_CORE_BUILD_DLL
48 #define BA_CORE_API_ __declspec(dllexport)
49 #else
50 #define BA_CORE_API_ __declspec(dllimport)
51 #endif // BA_CORE_BUILD_DLL
52 
53 #endif // _WIN32
54 
55 #ifndef BA_CORE_API_
56 #define BA_DEVICE_API_
57 #define BA_CORE_API_
58 #endif
59 
60 #endif // BORNAGAIN_WRAP_WINDLLMACROS_H