]> icculus.org git repositories - taylor/freespace2.git/blob - include/fxdll.h
Initial revision
[taylor/freespace2.git] / include / fxdll.h
1 /*
2 ** Copyright (c) 1995, 1996, 3Dfx Interactive, Inc.
3 ** All Rights Reserved.
4 **
5 ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of 3Dfx Interactive, Inc.;
6 ** the contents of this file may not be disclosed to third parties, copied or
7 ** duplicated in any form, in whole or in part, without the prior written
8 ** permission of 3Dfx Interactive, Inc.
9 **
10 ** RESTRICTED RIGHTS LEGEND:
11 ** Use, duplication or disclosure by the Government is subject to restrictions
12 ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
13 ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
14 ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished  -
15 ** rights reserved under the Copyright Laws of the United States.
16 **
17 ** $Revision$
18 ** $Date$
19 */
20 /* preprocessor defines for libraries to support DLL creation */
21
22 /* in header file, use FX_ENTRY return-type FX_CALL function-name ( ... ) */
23 /* in source file, use FX_EXPORT return-type FX_CSTYLE function-name (... ) */
24
25 /* in source file, set FX_DLL_DEFINITION, include this file, then include
26    header file for library. */
27
28 /* we need to use two macros per declaration/definition because MSVC
29    requires __stdcall and __declspec( dllexport ) be in different parts
30    of the prototype! */
31
32 /* I use two sets in case we need to control declarations and definitions
33    differently.  If it turns out we don't, it should be easy to do a search
34    and replace to eliminate one set */
35
36 /* NOTE: this header file may be included more than once, and FX_DLL_DEFINITION
37    may have changed, so we do not protect this with an #fndef __FXDLL_H__
38    statement like we normally would. */
39
40
41 #ifdef FX_ENTRY
42 #undef FX_ENTRY
43 #endif
44
45 #ifdef FX_CALL
46 #undef FX_CALL
47 #endif
48
49 #ifdef FX_EXPORT
50 #undef FX_EXPORT
51 #endif
52
53 #ifdef FX_CSTYLE
54 #undef FX_CSTYLE
55 #endif
56
57 #if defined(FX_DLL_DEFINITION)
58   #if defined(FX_DLL_ENABLE)
59     #if defined(__MSC__)
60       #ifndef KERNEL
61         #define FX_ENTRY __declspec( dllexport )
62         #define FX_EXPORT __declspec( dllexport )
63       #else
64         #define FX_ENTRY
65         #define FX_EXPORT
66      #endif /* #ifndef KERNEL */
67      #define FX_CALL __stdcall
68      #define FX_CSTYLE __stdcall
69
70     #elif defined(__WATCOMC__)
71       #define FX_ENTRY
72       #define FX_CALL __stdcall __export
73
74       #define FX_EXPORT
75       #define FX_CSTYLE __stdcall __export
76
77     #else /* compiler */
78       #error define FX_ENTRY,FX_CALL & FX_EXPORT,FX_CSTYLE for your compiler
79     #endif /* compiler */
80
81   #else /* FX_DLL_ENABLE */
82     #define FX_ENTRY
83     #define FX_CALL __stdcall
84
85     #define FX_EXPORT
86     #define FX_CSTYLE __stdcall
87   #endif /* FX_DLL_ENABLE */
88
89 #else /* FX_DLL_DEFINITION */
90   #define FX_ENTRY extern
91   #define FX_CALL __stdcall
92 #endif /* FX_DLL_DEFINITION */
93
94 /*
95  * We don't want any of this DLL junk for DJGPP or UNIX
96  * so undo what is done above.
97  */
98 #if defined(__DJGPP__) || defined(__unix__)
99   #ifdef FX_CALL
100     #undef FX_CALL
101   #endif
102
103   #ifdef FX_CSTYLE
104     #undef FX_CSTYLE
105   #endif
106
107   #ifdef FX_EXPORT
108     #undef FX_EXPORT
109   #endif
110
111   #ifdef FX_ENTRY
112     #undef FX_ENTRY
113   #endif
114
115   #define FX_CALL
116   #define FX_CSTYLE 
117   #define FX_EXPORT
118   #define FX_ENTRY 
119 #endif
120
121 #if defined (MSVC16)
122   #undef FX_CALL
123   #define FX_CALL
124 #endif
125