File: exportdefines.h

package info (click to toggle)
spring 103.0%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 43,720 kB
  • ctags: 63,685
  • sloc: cpp: 368,283; ansic: 33,988; python: 12,417; java: 12,203; awk: 5,879; sh: 1,846; xml: 655; perl: 405; php: 211; objc: 194; makefile: 77; sed: 2
file content (87 lines) | stat: -rw-r--r-- 2,774 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */

/*
 * This file has to be C99 compatible, as it is not only used by the engine,
 * but also by AIs.
 */

#ifndef _EXPORTDEFINES_H
#define _EXPORTDEFINES_H

#include "System/maindefines.h" // for __arch32__ / __arch64__

#ifndef EXTERNALIZER
	#if defined(__cplusplus)
		#define EXTERNALIZER extern "C"
	#else // __cplusplus
		// we dont have to export if we are in C already
		#define EXTERNALIZER
	#endif // __cplusplus
#endif // EXTERNALIZER

// extern declaration that will work across
// different platforms and compilers
#ifndef SHARED_EXPORT
	#if defined _WIN32 || defined __CYGWIN__
		#define SHARED_EXPORT EXTERNALIZER __declspec(dllexport)
		#define SPRING_API
	#elif __GNUC__ >= 4
		// Support for '-fvisibility=hidden'.
		#define SHARED_EXPORT EXTERNALIZER __attribute__ ((visibility("default")))
		#define SPRING_API __attribute__ ((visibility("default")))
	#else // _WIN32 || defined __CYGWIN__
		// Older versions of gcc have everything visible; no need for fancy stuff.
		#define SHARED_EXPORT EXTERNALIZER
		#define SPRING_API
	#endif // _WIN32 || defined __CYGWIN__
#endif // SHARED_EXPORT

// calling convention declaration that will work across
// different and compilers
// for all 64bit platforms, we do not specify a calling convetion,
// as they all support only a single one anyway
// for windows 32bit, we use stdcall
// for non-windows 32bit, we use cdecl

#ifndef SPRING_CALLING_CONVENTION
	#if defined _WIN32
		#define SPRING_CALLING_CONVENTION stdcall
		#define SPRING_CALLING_CONVENTION_2 __stdcall
	#elif defined __POWERPC__
		#define SPRING_CALLING_CONVENTION 
		#define SPRING_CALLING_CONVENTION_2 
	#else
		#define SPRING_CALLING_CONVENTION cdecl
		#define SPRING_CALLING_CONVENTION_2 __cdecl
	#endif // defined _WIN32
#endif // SPRING_CALLING_CONVENTION

#ifndef CALLING_CONV
	#if defined __arch64__
		#define CALLING_CONV
	#elif defined _WIN32
		#define CALLING_CONV SPRING_CALLING_CONVENTION_2
	#elif __GNUC__
		#define CALLING_CONV __attribute__ ((SPRING_CALLING_CONVENTION))
	#elif __INTEL_COMPILER
		#define CALLING_CONV __attribute__ ((SPRING_CALLING_CONVENTION))
	#else // defined _WIN64 ...
		#define CALLING_CONV SPRING_CALLING_CONVENTION_2
	#endif // defined _WIN64 ...
#endif // CALLING_CONV

// Intel Compiler compatibility fix for non-Windows
// Is used when assigning function pointers, for example in:
// ExternalAI/AIInterfaceLibrary.cpp
#ifndef CALLING_CONV_FUNC_POINTER
	#if !defined(_WIN32) && defined(__INTEL_COMPILER)
		#define CALLING_CONV_FUNC_POINTER
	#else
		#define CALLING_CONV_FUNC_POINTER CALLING_CONV
	#endif
#endif // CALLING_CONV_FUNC_POINTER

#define EXPORT(type) SHARED_EXPORT type CALLING_CONV


#endif // _EXPORTDEFINES_H