muParser API -  1.35
muParserFixes.h
Go to the documentation of this file.
1 /*
2 
3  _____ __ _____________ _______ ______ ___________
4  / \| | \____ \__ \\_ __ \/ ___// __ \_ __ \
5  | Y Y \ | / |_> > __ \| | \/\___ \\ ___/| | \/
6  |__|_| /____/| __(____ /__| /____ >\___ >__|
7  \/ |__| \/ \/ \/
8  Copyright (C) 2004 - 2020 Ingo Berg
9 
10  Redistribution and use in source and binary forms, with or without modification, are permitted
11  provided that the following conditions are met:
12 
13  * Redistributions of source code must retain the above copyright notice, this list of
14  conditions and the following disclaimer.
15  * Redistributions in binary form must reproduce the above copyright notice, this list of
16  conditions and the following disclaimer in the documentation and/or other materials provided
17  with the distribution.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
20  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 
29 #ifndef MU_PARSER_FIXES_H
30 #define MU_PARSER_FIXES_H
31 
32 /** \file
33  \brief This file contains compatibility fixes for some platforms.
34 */
35 
36 //
37 // Compatibility fixes
38 //
39 
40 /* From http://gcc.gnu.org/wiki/Visibility */
41 /* Generic helper definitions for shared library support */
42 #if defined _WIN32 || defined __CYGWIN__
43  #define MUPARSER_HELPER_DLL_IMPORT __declspec(dllimport)
44  #define MUPARSER_HELPER_DLL_EXPORT __declspec(dllexport)
45  #define MUPARSER_HELPER_DLL_LOCAL
46 #else
47  #if __GNUC__ >= 4
48  #define MUPARSER_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
49  #define MUPARSER_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
50  #define MUPARSER_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
51  #else
52  #define MUPARSER_HELPER_DLL_IMPORT
53  #define MUPARSER_HELPER_DLL_EXPORT
54  #define MUPARSER_HELPER_DLL_LOCAL
55  #endif
56 #endif
57 
58 /*
59  Now we use the generic helper definitions above to define API_EXPORT_CXX and MUPARSER_LOCAL.
60  API_EXPORT_CXX is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
61  MUPARSER_LOCAL is used for non-api symbols.
62 */
63 
64 #ifndef MUPARSER_STATIC /* defined if muParser is compiled as a DLL */
65 
66  #ifdef MUPARSERLIB_EXPORTS /* defined if we are building the muParser DLL (instead of using it) */
67  #define API_EXPORT_CXX MUPARSER_HELPER_DLL_EXPORT
68  #else
69  #define API_EXPORT_CXX MUPARSER_HELPER_DLL_IMPORT
70  #endif /* MUPARSER_DLL_EXPORTS */
71  #define MUPARSER_LOCAL MUPARSER_HELPER_DLL_LOCAL
72 
73 #else /* MUPARSER_STATIC is defined: this means muParser is a static lib. */
74 
75  #define API_EXPORT_CXX
76  #define MUPARSER_LOCAL
77 
78 #endif /* !MUPARSER_STATIC */
79 
80 
81 #ifdef _WIN32
82  #define API_EXPORT(TYPE) API_EXPORT_CXX TYPE __cdecl
83 #else
84  #define API_EXPORT(TYPE) TYPE
85 #endif
86 
87 
88 #endif // include guard
89 
90