annotate dyncall/dyncall_macros.h @ 616:5d999f5c13d1

- fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with) - cosmetic cleanups for consistency - added runtime detection to dyncall_macros.h to handle some edge cases - fixed detection of native thiscall callconv for builds not using MSVC but using (or adhering to) the MSVC runtime (e.g. ReactOS' MinGW based RosBE)
author Tassilo Philipp
date Sun, 02 Oct 2022 13:58:33 +0200
parents dfc2e6ee8782
children 6a8aac9b2bcf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 Package: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 Library: dyncall
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5 File: dyncall/dyncall_macros.h
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 Description: Platform detection macros
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 License:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8
281
f5577f6bf97a - file header cleanups for release
Tassilo Philipp
parents: 268
diff changeset
9 Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>,
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 Tassilo Philipp <tphilipp@potion-studios.com>
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 Permission to use, copy, modify, and distribute this software for any
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 purpose with or without fee is hereby granted, provided that the above
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 copyright notice and this permission notice appear in all copies.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 /*
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
30 dyncall macros
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
31
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
32 Platform detection, specific defines and configuration.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
33 The purpose of this file is to provide coherent platform and compiler
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
34 specific defines. So instead of defines like WIN32, _OpenBSD_ or
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
35 __GNUC__, one should use DC__OS_Win32, DC__OS_OpenBSD or DC__C_GNU,
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
36 respectively.
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
37
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
38 REVISION
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
39 2007/12/11 initial
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
40
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
41 */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
42
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
43
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
44 #ifndef DYNCALL_MACROS_H
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
45 #define DYNCALL_MACROS_H
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
46
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
47
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
48
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
49 /* -- Platform specific #defines ------------------------------------ */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
50
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
51 /* MS Windows XP x64/Vista64 or later. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
52 #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
53 # define DC__OS_Win64
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
54
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
55 /* MS Windows NT/95/98/ME/2000/XP/Vista32. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
56 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__WINDOWS__) || defined(_WINDOWS)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
57 # define DC__OS_Win32
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
58
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
59 /* All the OS' based on Darwin OS (MacOS X, OpenDarwin). Note that '__APPLE__' may be defined for classic MacOS, too. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
60 /* __MACOSX__ is not defined in gcc assembler mode (switch: -S) */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
61 #elif defined(__APPLE__) || defined(__Darwin__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
62 # define DC__OS_Darwin
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
63 # if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
64 # define DC__OS_IPhone
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
65 # else /* defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) */
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
66 # define DC__OS_MacOSX
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
67 # endif
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
68
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
69 /* The most popular open source Unix-like OS - Linux. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
70 #elif defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
71 # define DC__OS_Linux
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
72
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
73 /* The most powerful open source Unix-like OS - FreeBSD. */
254
9d70178c1ded - better cpp checking whether dlinfo() is available, to also cover GLIBC based systems that don't identify as Linux (e.g. debian/k*BSD)
Tassilo Philipp
parents: 204
diff changeset
74 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) /* latter is (also) used by systems using FreeBSD kernel, e.g. Debian/kFreeBSD, which could be detected specifically by also checking for __GLIBC__ */
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
75 # define DC__OS_FreeBSD
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
76
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
77 /* The most secure open source Unix-like OS - OpenBSD. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
78 #elif defined(__OpenBSD__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
79 # define DC__OS_OpenBSD
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
80
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
81 /* The most portable open source Unix-like OS - NetBSD. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
82 #elif defined(__NetBSD__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
83 # define DC__OS_NetBSD
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
84
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
85 /* The FreeBSD fork having heavy clusterization in mind - DragonFlyBSD. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
86 #elif defined(__DragonFly__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
87 # define DC__OS_DragonFlyBSD
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
88
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
89 /* Sun's Unix-like OS - SunOS / Solaris. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
90 #elif defined(__sun__) || defined(__sun) || defined(sun)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
91 # define DC__OS_SunOS
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
92
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
93 /* The Nintendo DS (homebrew) using devkitpro. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
94 #elif defined(__nds__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
95 # define DC__OS_NDS
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
96
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
97 /* The PlayStation Portable (homebrew) SDK. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
98 #elif defined(__psp__) || defined(PSP)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
99 # define DC__OS_PSP
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
100
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
101 /* Haiku (BeOS alike). */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
102 #elif defined(__HAIKU__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
103 # define DC__OS_BeOS
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
104
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
105 /* The Unix successor - Plan9 from Bell Labs */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
106 #elif defined(Plan9) || defined(__Plan9__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
107 # define DC__OS_Plan9
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
108
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
109 /* Digital's Unix-like OS - VMS */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
110 #elif defined(__vms)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
111 # define DC__OS_VMS
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
112
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
113 /* Tanenbaum's Microkernel OS - Minix */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
114 #elif defined(__minix)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
115 # define DC__OS_Minix
174
a8052efbde18 - loosened OS detection macros a bit to not bail out and thus make it easier to use dyncall on baremetal
cslag
parents: 141
diff changeset
116
a8052efbde18 - loosened OS detection macros a bit to not bail out and thus make it easier to use dyncall on baremetal
cslag
parents: 141
diff changeset
117 /* Unable to determine OS, which is probably ok (e.g. baremetal stuff, etc.). */
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
118 #else
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
119 # define DC__OS_UNKNOWN
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
120
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
121 #endif
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
122
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
123
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
124 /* windows sub envs */
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
125 #if defined(DC__OS_Win32) || defined(DC__OS_Win64)
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
126
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
127 /* The "Linux-like environment for Windows" - Cygwin. */
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
128 # if defined(__CYGWIN__)
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
129 # define DC__OS_Cygwin
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
130
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
131 /* The "Minimalist GNU for Windows" - MinGW. */
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
132 # elif defined(__MINGW32__) || defined(__MINGW64__)
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
133 # define DC__OS_MinGW
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
134 # endif
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
135
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
136 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
137
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
138
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
139
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
140 /* -- Compiler specific #defines ------------------------------------ */
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
141
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
142 /* Don't change the order, b/c some compilers use same #defines compatibility */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
143
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
144 /* Intel's C/C++ compiler. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
145 #if defined(__INTEL_COMPILER)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
146 # define DC__C_Intel
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
147
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
148 /* MS C/C++ compiler. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
149 #elif defined(_MSC_VER)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
150 # define DC__C_MSVC
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
151
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
152 /* LLVM clang. */
268
03f0b683918a - reintroduced .note.GNU-stack section, as mentioned in prev commit
Tassilo Philipp
parents: 261
diff changeset
153 #elif defined(__clang__) || defined(__llvm__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
154 # define DC__C_CLANG
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
155
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
156 /* The GNU Compiler Collection - GCC. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
157 #elif defined(__GNUC__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
158 # define DC__C_GNU
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
159
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
160 /* Watcom compiler. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
161 #elif defined(__WATCOMC__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
162 # define DC__C_WATCOM
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
163
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
164 /* Portable C Compiler. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
165 #elif defined(__PCC__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
166 # define DC__C_PCC
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
167
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
168 /* Sun Pro C. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
169 #elif defined(__SUNPRO_C)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
170 # define DC__C_SUNPRO
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
171
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
172 /* Undetected C Compiler. */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
173 #else
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
174 # define DC__C_UNKNOWN
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
175 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
176
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
177
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
178
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
179 /* -- Architecture -------------------------------------------------- */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
180
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
181 /* Check architecture. */
31
6e7b1b7ad9d3 Fixed failing builds when the compiler is ICC/ICPC
Snaipe <franklinmathieu@gmail.com>
parents: 0
diff changeset
182 #if defined(_M_X64_) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
6e7b1b7ad9d3 Fixed failing builds when the compiler is ICC/ICPC
Snaipe <franklinmathieu@gmail.com>
parents: 0
diff changeset
183 # define DC__Arch_AMD64
6e7b1b7ad9d3 Fixed failing builds when the compiler is ICC/ICPC
Snaipe <franklinmathieu@gmail.com>
parents: 0
diff changeset
184 #elif defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__386__) || defined(__i386)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
185 # define DC__Arch_Intel_x86
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
186 #elif defined(_M_IA64) || defined(__ia64__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
187 # define DC__Arch_Itanium
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
188 #elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__ppc__) || defined(__power__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
189 # if defined(__ppc64__) || defined(_ARCH_PPC64) || defined(__power64__) || defined(__powerpc64__)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
190 # define DC__Arch_PPC64
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
191 # else
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
192 # define DC__Arch_PPC32
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
193 # endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
194 #elif defined(__mips64__) || defined(__mips64)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
195 # define DC__Arch_MIPS64
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
196 #elif defined(_M_MRX000) || defined(__mips__) || defined(__mips) || defined(_mips)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
197 # define DC__Arch_MIPS
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
198 #elif defined(__arm__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
199 # define DC__Arch_ARM
371
451299d50c1a - windows arm64 support (dyncall, dyncallback, cmake support for armasm64), thanks Bernhard Urban-Forster!
Tassilo Philipp
parents: 302
diff changeset
200 #elif defined(_M_ARM64) || defined(__aarch64__) || defined(__arm64) || defined(__arm64__)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
201 # define DC__Arch_ARM64
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
202 #elif defined(__sh__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
203 # define DC__Arch_SuperH
180
629cfbba5ba0 - sparc predef cleanup
cslag
parents: 179
diff changeset
204 #elif defined(__sparc) || defined(__sparc__)
629cfbba5ba0 - sparc predef cleanup
cslag
parents: 179
diff changeset
205 # if defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || defined(__arch64__)
629cfbba5ba0 - sparc predef cleanup
cslag
parents: 179
diff changeset
206 # define DC__Arch_Sparc64
629cfbba5ba0 - sparc predef cleanup
cslag
parents: 179
diff changeset
207 # else
629cfbba5ba0 - sparc predef cleanup
cslag
parents: 179
diff changeset
208 # define DC__Arch_Sparc
629cfbba5ba0 - sparc predef cleanup
cslag
parents: 179
diff changeset
209 # endif
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
210 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
211
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
212
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
213
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
214 /* -- Runtime ------------------------------------------------------- */
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
215
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
216 #if defined(__MSVCRT__)
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
217 # define DC__RT_MSVCRT
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
218 #endif
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
219
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
220
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
221 /* -- Rough OS classification --------------------------------------- */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
222
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
223 #if defined(DC__OS_Win32) || defined(DC__OS_Win64)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
224 # define DC_WINDOWS
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
225 #elif defined(DC__OS_Plan9)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
226 # define DC_PLAN9
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
227 #elif defined(DC__OS_NDS) || defined(DC__OS_PSP)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
228 # define DC_OTHER
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
229 #else
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
230 # define DC_UNIX
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
231 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
232
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
233
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
234
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
235 /* -- Misc machine-dependent modes, ABIs, etc. ---------------------- */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
236
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
237 #if defined(__arm__) && !defined(__thumb__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
238 # define DC__Arch_ARM_ARM
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
239 #elif defined(__arm__) && defined(__thumb__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
240 # define DC__Arch_ARM_THUMB
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
241 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
242
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
243 #if defined(DC__Arch_ARM_ARM) || defined(DC__Arch_ARM_THUMB)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
244 # if defined(__ARM_EABI__) || defined(DC__OS_NDS)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
245 # if defined (__ARM_PCS_VFP) && (__ARM_PCS_VFP == 1)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
246 # define DC__ABI_ARM_HF
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
247 # else
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
248 # define DC__ABI_ARM_EABI
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
249 # endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
250 # elif defined(__APCS_32__)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
251 # define DC__ABI_ARM_OABI
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
252 # endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
253 #endif /* ARM */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
254
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
255 #if defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64)
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
256 # if defined(_ABIO32) || defined(__mips_o32) || defined(_MIPS_ARCH_MIPS1) || defined(_MIPS_ARCH_MIPS2)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
257 # define DC__ABI_MIPS_O32
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
258 # elif defined(_ABI64) || defined(__mips_n64)
112
0baf4f79a8c5 - added __mips_n64 predef detection to macros.h
cslag
parents: 101
diff changeset
259 # define DC__ABI_MIPS_N64
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
260 # elif defined(_ABIN32)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
261 # define DC__ABI_MIPS_N32
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
262 # else
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
263 # define DC__ABI_MIPS_EABI
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
264 # endif
302
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
265 /* Set extra flag to know if FP hardware ABI, default to yes, if unsure */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
266 # if (defined(__mips_hard_float) && (__mips_hard_float == 1)) || !defined(__mips_soft_float) || (__mips_soft_float != 1)
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
267 # define DC__ABI_HARDFLOAT /* @@@ make this general for all archs? */
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
268 # else
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
269 # define DC__ABI_SOFTFLOAT
d55f9d508074 - mips softfloat support for o32 callconv (calls and callbacks, little and big endian)
Tassilo Philipp
parents: 281
diff changeset
270 # endif
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
271 #endif /* MIPS */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
272
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
273 #if defined(DC__Arch_PPC64)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
274 # if defined(_CALL_ELF)
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
275 # define DC__ABI_PPC64_ELF_V _CALL_ELF
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
276 # else
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
277 # define DC__ABI_PPC64_ELF_V 0 /* 0 means not explicitly set, otherwise this is 1 (big endian) and 2 (little endian) */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
278 # endif
112
0baf4f79a8c5 - added __mips_n64 predef detection to macros.h
cslag
parents: 101
diff changeset
279 #endif /* PPC64 */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
280
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
281
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
282
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
283 /* -- Endianness detection ------------------------------------------ */
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
284
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
285 #if defined(DC__Arch_Intel_x86) || defined(DC__Arch_AMD64) /* always little */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
286 # define DC__Endian_LITTLE
179
b11b0735b09f - renamings: sparc_v9 -> sparc64
cslag
parents: 174
diff changeset
287 #elif defined(DC__Arch_Sparc) /* always purely big until v9 */
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
288 # define DC__Endian_BIG
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
289 #else /* all others are bi-endian */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
290 /* @@@check flags used on following bi-endianness archs:
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
291 DC__Arch_Itanium
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
292 DC__Arch_PPC32
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
293 DC__Arch_PPC64
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
294 DC__Arch_SuperH
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
295 */
588
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
296 # if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(MIPSEB) || defined(_MIPSEB) || defined(__MIPSEB) || defined(__MIPSEB__) || defined(__ARMEB__) || defined(__AARCH64EB__)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
297 # define DC__Endian_BIG
588
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
298 # elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(MIPSEL) || defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || defined(__ARMEL__) || defined(__AARCH64EL__)
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
299 # define DC__Endian_LITTLE
204
a74e2cd93348 - sparc64 endian detection on non-explicit platforms
Tassilo Philipp
parents: 188
diff changeset
300 # elif defined(DC__Arch_Sparc64) && !defined(__BYTE_ORDER__) /* Sparc64 default is big-endian, except if explicitly defined */
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
301 # define DC__Endian_BIG
588
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
302 # elif defined(BYTE_ORDER) || defined(_BYTE_ORDER) || defined(__BYTE_ORDER__) /* explicitly set byte order, either through compiler or platform specific endian.h */
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
303 # if (defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)) || (defined(_BIG_ENDIAN) && (_BYTE_ORDER == _BIG_ENDIAN)) || (defined(__ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
304 # define DC__Endian_BIG
588
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
305 # elif (defined(LITTLE_ENDIAN) && (BYTE_ORDER == LITTLE_ENDIAN)) || (defined(_LITTLE_ENDIAN) && (_BYTE_ORDER == _LITTLE_ENDIAN)) || (defined(__ORDER_LITTLE_ENDIAN__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
306 # define DC__Endian_LITTLE
188
44ae5b653086 - more endian detection in macros
Tassilo Philipp
parents: 180
diff changeset
307 # endif
588
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
308 # elif (defined(_BIG_ENDIAN) && (_BIG_ENDIAN == 1)) || (defined(__BIG_ENDIAN__) && (__BIG_ENDIAN__ == 1)) /* explicitly set as on/off */
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
309 # define DC__Endian_BIG
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
310 # elif (defined(_LITTLE_ENDIAN) && (_LITTLE_ENDIAN == 1)) || (defined(__LITTLE_ENDIAN__) && (__LITTLE_ENDIAN__ == 1)) /* explicitly set as on/off */
dfc2e6ee8782 - more robust endian detection, on some platforms inclusion of endian.h led to assuming wrong endianness (subtle if inclusion was in
Tassilo Philipp
parents: 531
diff changeset
311 # define DC__Endian_LITTLE
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
312 # endif /* no else, leave unset if not sure */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
313 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
314
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
315
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
316
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
317 /* -- Internal macro/tag -------------------------------------------- */
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
318
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
319 #if !defined(DC_API)
188
44ae5b653086 - more endian detection in macros
Tassilo Philipp
parents: 180
diff changeset
320 # define DC_API
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
321 #endif
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
322
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
323
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
324
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
325 /* -- Library feature support macors -------------------------------- */
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
326
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
327 /* macros for specifying lesser used feature support (main features like basic
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
328 call and callback support are required for a platform implementation */
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
329
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
330 /* syscalls */
531
f6430d194be6 cleanups
Tassilo Philipp
parents: 488
diff changeset
331 #if (defined(DC__Arch_Intel_x86) || (defined(DC__Arch_AMD64) && defined(DC_UNIX)) || defined(DC__Arch_PPC32) || defined(DC__Arch_PPC64)) && \
f6430d194be6 cleanups
Tassilo Philipp
parents: 488
diff changeset
332 !defined(DC__OS_MacOSX) && !defined(DC__OS_Plan9) && !defined(DC__OS_NDS) && !defined(DC__OS_PSP) && !defined(DC__OS_Minix) && !defined(DC__OS_SunOS) && !defined(DC__OS_BeOS)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
333 # define DC__Feature_Syscall
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
334 #endif
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
335
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
336 /* aggregate (struct, union) by value */
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
337 #if defined(DC__Arch_AMD64)
616
5d999f5c13d1 - fixed mingw and cygwin env detection (was always shadowed by _WIN32 macro detection, and __MINGW__ macro check was wrong to begin with)
Tassilo Philipp
parents: 588
diff changeset
338 # define DC__Feature_AggrByVal
488
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
339 #endif
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
340
1455b6beedd9 - added feature-testing macros for syscall and aggregate (struct, union) by value support
Tassilo Philipp
parents: 371
diff changeset
341
0
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
342 #endif /* DYNCALL_MACROS_H */
3e629dc19168 initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
343