Mercurial > pub > dyncall > dyncall
comparison dyncall/dyncall_macros.h @ 488:1455b6beedd9
- added feature-testing macros for syscall and aggregate (struct, union) by value support
author | Tassilo Philipp |
---|---|
date | Fri, 18 Mar 2022 10:10:16 +0100 |
parents | 451299d50c1a |
children | f6430d194be6 |
comparison
equal
deleted
inserted
replaced
487:d8f0e6cecdab | 488:1455b6beedd9 |
---|---|
43 | 43 |
44 #ifndef DYNCALL_MACROS_H | 44 #ifndef DYNCALL_MACROS_H |
45 #define DYNCALL_MACROS_H | 45 #define DYNCALL_MACROS_H |
46 | 46 |
47 | 47 |
48 /* Platform specific defines. */ | 48 |
49 /* -- Platform specific #defines ------------------------------------ */ | |
49 | 50 |
50 /* MS Windows XP x64/Vista64 or later. */ | 51 /* MS Windows XP x64/Vista64 or later. */ |
51 #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) | 52 #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) |
52 #define DC__OS_Win64 | 53 #define DC__OS_Win64 |
53 | 54 |
128 #define DC__OS_UNKNOWN | 129 #define DC__OS_UNKNOWN |
129 #endif | 130 #endif |
130 | 131 |
131 | 132 |
132 | 133 |
133 /* Compiler specific defines. Do not change the order, because */ | 134 /* -- Compiler specific #defines ------------------------------------ */ |
134 /* some of the compilers define flags for compatible ones, too. */ | 135 |
136 /* Don't change the order, b/c some compilers use same #defines compatibility */ | |
135 | 137 |
136 /* Intel's C/C++ compiler. */ | 138 /* Intel's C/C++ compiler. */ |
137 #if defined(__INTEL_COMPILER) | 139 #if defined(__INTEL_COMPILER) |
138 #define DC__C_Intel | 140 #define DC__C_Intel |
139 | 141 |
166 #define DC__C_UNKNOWN | 168 #define DC__C_UNKNOWN |
167 #endif | 169 #endif |
168 | 170 |
169 | 171 |
170 | 172 |
171 /* Architecture. */ | 173 /* -- Architecture -------------------------------------------------- */ |
172 | 174 |
173 /* Check architecture. */ | 175 /* Check architecture. */ |
174 #if defined(_M_X64_) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) | 176 #if defined(_M_X64_) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) |
175 # define DC__Arch_AMD64 | 177 # define DC__Arch_AMD64 |
176 #elif defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__386__) || defined(__i386) | 178 #elif defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__386__) || defined(__i386) |
201 # endif | 203 # endif |
202 #endif | 204 #endif |
203 | 205 |
204 | 206 |
205 | 207 |
206 /* Rough OS classification. */ | 208 /* -- Rough OS classification --------------------------------------- */ |
207 | 209 |
208 #if defined(DC__OS_Win32) || defined(DC__OS_Win64) | 210 #if defined(DC__OS_Win32) || defined(DC__OS_Win64) |
209 # define DC_WINDOWS | 211 # define DC_WINDOWS |
210 #elif defined(DC__OS_Plan9) | 212 #elif defined(DC__OS_Plan9) |
211 # define DC_PLAN9 | 213 # define DC_PLAN9 |
215 # define DC_UNIX | 217 # define DC_UNIX |
216 #endif | 218 #endif |
217 | 219 |
218 | 220 |
219 | 221 |
220 /* Misc machine-dependent modes, ABIs, etc.. */ | 222 /* -- Misc machine-dependent modes, ABIs, etc. ---------------------- */ |
221 | 223 |
222 #if defined(__arm__) && !defined(__thumb__) | 224 #if defined(__arm__) && !defined(__thumb__) |
223 # define DC__Arch_ARM_ARM | 225 # define DC__Arch_ARM_ARM |
224 #elif defined(__arm__) && defined(__thumb__) | 226 #elif defined(__arm__) && defined(__thumb__) |
225 # define DC__Arch_ARM_THUMB | 227 # define DC__Arch_ARM_THUMB |
262 # define DC__ABI_PPC64_ELF_V 0 /* 0 means not explicitly set, otherwise this is 1 (big endian) and 2 (little endian) */ | 264 # define DC__ABI_PPC64_ELF_V 0 /* 0 means not explicitly set, otherwise this is 1 (big endian) and 2 (little endian) */ |
263 # endif | 265 # endif |
264 #endif /* PPC64 */ | 266 #endif /* PPC64 */ |
265 | 267 |
266 | 268 |
267 /* Endian detection. */ | 269 |
270 /* -- Endianness detection ------------------------------------------ */ | |
271 | |
268 #if defined(DC__Arch_Intel_x86) || defined(DC__Arch_AMD64) /* always little */ | 272 #if defined(DC__Arch_Intel_x86) || defined(DC__Arch_AMD64) /* always little */ |
269 # define DC__Endian_LITTLE | 273 # define DC__Endian_LITTLE |
270 #elif defined(DC__Arch_Sparc) /* always purely big until v9 */ | 274 #elif defined(DC__Arch_Sparc) /* always purely big until v9 */ |
271 # define DC__Endian_BIG | 275 # define DC__Endian_BIG |
272 #else /* all others are bi-endian */ | 276 #else /* all others are bi-endian */ |
290 # endif | 294 # endif |
291 # endif /* no else, leave unset if not sure */ | 295 # endif /* no else, leave unset if not sure */ |
292 #endif | 296 #endif |
293 | 297 |
294 | 298 |
295 /* Internal macro/tag. */ | 299 |
300 /* -- Internal macro/tag -------------------------------------------- */ | |
301 | |
296 #if !defined(DC_API) | 302 #if !defined(DC_API) |
297 # define DC_API | 303 # define DC_API |
298 #endif | 304 #endif |
299 | 305 |
306 | |
307 | |
308 /* -- Library feature support macors -------------------------------- */ | |
309 | |
310 /* macros for specifying lesser used feature support (main features like basic | |
311 call and callback support are required for a platform implementation */ | |
312 | |
313 /* syscalls */ | |
314 #if defined(DC__Arch_Intel_x86) || (defined(DC__Arch_AMD64) && defined(DC_UNIX)) || defined(DC__Arch_PPC32) || defined(DC__Arch_PPC64) | |
315 # define DC__Feature_Syscall | |
316 #endif | |
317 | |
318 /* aggregate (struct, union) by value */ | |
319 #if defined(DC__Arch_AMD64) | |
320 # define DC__Feature_AggrByVal | |
321 #endif | |
322 | |
323 | |
300 #endif /* DYNCALL_MACROS_H */ | 324 #endif /* DYNCALL_MACROS_H */ |
301 | 325 |