HermesCommon  2.0
compat.h
Go to the documentation of this file.
1 // This file is part of HermesCommon
2 //
3 // Copyright (c) 2009 hp-FEM group at the University of Nevada, Reno (UNR).
4 // Email: hpfem-group@unr.edu, home page: http://hpfem.org/.
5 //
6 // Hermes2D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published
8 // by the Free Software Foundation; either version 2 of the License,
9 // or (at your option) any later version.
10 //
11 // Hermes2D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with Hermes2D; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef __HERMES_COMMON_COMPAT_H
24 #define __HERMES_COMMON_COMPAT_H
25 #include <stdio.h>
26 
27 #ifndef HAVE_FMEMOPEN
28 
29 FILE *fmemopen (void *buf, size_t size, const char *opentype);
30 #endif
31 
32 // Windows DLL export/import definitions
33 #if defined (AGROS)
34  #if defined (HERMES_FOR_AGROS)
35  #define HERMES_API __declspec(dllexport)
36  #else
37  #define HERMES_API __declspec(dllimport)
38  #endif
39 #else
40  #if defined(WIN32) || defined(_WINDOWS)
41  // Visual Studio 2010.
42  #if defined(EXPORT_HERMES_DLL)
43  // when building DLL (target project defines this macro)
44  #define HERMES_API __declspec(dllexport)
45  #else
46  // when using the DLL by a client project
47  #define HERMES_API __declspec(dllimport)
48  #endif
49  #else
50  #define HERMES_API
51  #endif
52 #endif
53 
54 #ifndef HAVE_STRCASECMP
55 #define strcasecmp strcmp
56 #endif
57 
58 //C99 functions
59 #include "c99_functions.h"
60 
61 // Microsoft does not recognize long double and handles it just like double.
62 #ifdef _MSC_VER
63  #ifdef strtold
64  #undef strtold
65  #endif
66  #define strtold strtod
67 #endif
68 
69 #ifdef __GNUC__
70  #define NORETURN __attribute__((noreturn))
71 #else
72  #define NORETURN
73  #ifndef __attribute__
74  #define __attribute__(x)
75  #endif
76 #endif
77 
78 #endif