VirtualBox

source: vbox/trunk/include/VBox/cdefs.h@ 23746

Last change on this file since 23746 was 22802, checked in by vboxsync, 15 years ago

VBox/cdefs.h: Added VMM*_INT_DECL and made the VMMR?CDECL macros use DECL_INVALID for contexts where they aren't valid.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.6 KB
Line 
1/** @file
2 * VirtualBox - Common C and C++ definition.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 *
25 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___VBox_cdefs_h
31#define ___VBox_cdefs_h
32
33#include <iprt/cdefs.h>
34
35
36/** @def VBOX_WITH_STATISTICS
37 * When defined all statistics will be included in the build.
38 * This is enabled by default in all debug builds.
39 */
40#ifndef VBOX_WITH_STATISTICS
41# ifdef DEBUG
42# define VBOX_WITH_STATISTICS
43# endif
44#endif
45
46/** @def VBOX_STRICT
47 * Alias for RT_STRICT.
48 */
49#ifdef RT_STRICT
50# ifndef VBOX_STRICT
51# define VBOX_STRICT
52# endif
53#endif
54
55
56/*
57 * Shut up DOXYGEN warnings and guide it properly thru the code.
58 */
59#ifdef __DOXYGEN__
60#define VBOX_WITH_STATISTICS
61#define VBOX_STRICT
62#define IN_DIS
63#define IN_INTNET_R0
64#define IN_INTNET_R3
65#define IN_REM_R3
66#define IN_SUP_R0
67#define IN_SUP_R3
68#define IN_SUP_GC
69#define IN_USBLIB
70#define IN_VBOXDDU
71#define IN_VMM_RC
72#define IN_VMM_R0
73#define IN_VMM_R3
74/** @todo fixme */
75#endif
76
77
78
79
80/** @def VBOXCALL
81 * The standard calling convention for VBOX interfaces.
82 */
83#define VBOXCALL RTCALL
84
85
86
87/** @def IN_DIS
88 * Used to indicate whether we're inside the same link module as the
89 * disassembler.
90 */
91/** @def DISDECL(type)
92 * Disassembly export or import declaration.
93 * @param type The return type of the function declaration.
94 */
95#if defined(IN_DIS)
96# define DISDECL(type) DECLEXPORT(type) VBOXCALL
97#else
98# define DISDECL(type) DECLIMPORT(type) VBOXCALL
99#endif
100
101
102
103/** @def IN_DBG
104 * Used to indicate whether we're inside the same link module as the debugger
105 * console, gui, and related things (ring-3).
106 */
107/** @def DBGDECL(type)
108 * Debugger module export or import declaration.
109 * Functions declared using this exists only in R3 since the
110 * debugger modules is R3 only.
111 * @param type The return type of the function declaration.
112 */
113#if defined(IN_DBG_R3) || defined(IN_DBG)
114# define DBGDECL(type) DECLEXPORT(type) VBOXCALL
115#else
116# define DBGDECL(type) DECLIMPORT(type) VBOXCALL
117#endif
118
119
120
121/** @def IN_INTNET_R3
122 * Used to indicate whether we're inside the same link module as the Ring 3
123 * Internal Networking Service.
124 */
125/** @def INTNETR3DECL(type)
126 * Internal Networking Service export or import declaration.
127 * @param type The return type of the function declaration.
128 */
129#ifdef IN_INTNET_R3
130# define INTNETR3DECL(type) DECLEXPORT(type) VBOXCALL
131#else
132# define INTNETR3DECL(type) DECLIMPORT(type) VBOXCALL
133#endif
134
135/** @def IN_INTNET_R0
136 * Used to indicate whether we're inside the same link module as the R0
137 * Internal Network Service.
138 */
139/** @def INTNETR0DECL(type)
140 * Internal Networking Service export or import declaration.
141 * @param type The return type of the function declaration.
142 */
143#ifdef IN_INTNET_R0
144# define INTNETR0DECL(type) DECLEXPORT(type) VBOXCALL
145#else
146# define INTNETR0DECL(type) DECLIMPORT(type) VBOXCALL
147#endif
148
149
150
151/** @def IN_REM_R3
152 * Used to indicate whether we're inside the same link module as
153 * the HC Ring-3 Recompiled Execution Manager.
154 */
155/** @def REMR3DECL(type)
156 * Recompiled Execution Manager HC Ring-3 export or import declaration.
157 * @param type The return type of the function declaration.
158 */
159#ifdef IN_REM_R3
160# define REMR3DECL(type) DECLEXPORT(type) VBOXCALL
161#else
162# define REMR3DECL(type) DECLIMPORT(type) VBOXCALL
163#endif
164
165
166
167/** @def IN_SUP_R3
168 * Used to indicate whether we're inside the same link module as the Ring 3 Support Library or not.
169 */
170/** @def SUPR3DECL(type)
171 * Support library export or import declaration.
172 * @param type The return type of the function declaration.
173 */
174#ifdef IN_SUP_R3
175# define SUPR3DECL(type) DECLEXPORT(type) VBOXCALL
176#else
177# define SUPR3DECL(type) DECLIMPORT(type) VBOXCALL
178#endif
179
180/** @def IN_SUP_R0
181 * Used to indicate whether we're inside the same link module as the Ring 0 Support Library or not.
182 */
183/** @def SUPR0DECL(type)
184 * Support library export or import declaration.
185 * @param type The return type of the function declaration.
186 */
187#ifdef IN_SUP_R0
188# ifdef IN_SUP_STATIC
189# define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
190# else
191# define SUPR0DECL(type) DECLEXPORT(type) VBOXCALL
192# endif
193#else
194# ifdef IN_SUP_STATIC
195# define SUPR0DECL(type) DECLHIDDEN(type) VBOXCALL
196# else
197# define SUPR0DECL(type) DECLIMPORT(type) VBOXCALL
198# endif
199#endif
200
201/** @def IN_SUP_GC
202 * Used to indicate whether we're inside the same link module as the GC Support Library or not.
203 */
204/** @def SUPGCDECL(type)
205 * Support library export or import declaration.
206 * @param type The return type of the function declaration.
207 */
208#ifdef IN_SUP_GC
209# define SUPGCDECL(type) DECLEXPORT(type) VBOXCALL
210#else
211# define SUPGCDECL(type) DECLIMPORT(type) VBOXCALL
212#endif
213
214/** @def IN_SUP_R0
215 * Used to indicate whether we're inside the same link module as the Ring 0 Support Library or not.
216 */
217/** @def SUPR0DECL(type)
218 * Support library export or import declaration.
219 * @param type The return type of the function declaration.
220 */
221#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_GC)
222# define SUPDECL(type) DECLEXPORT(type) VBOXCALL
223#else
224# define SUPDECL(type) DECLIMPORT(type) VBOXCALL
225#endif
226
227
228
229/** @def IN_USBLIB
230 * Used to indicate whether we're inside the same link module as the USBLib.
231 */
232/** @def USBLIB_DECL
233 * USBLIB export or import declaration.
234 * @param type The return type of the function declaration.
235 */
236#ifdef IN_RING0
237# define USBLIB_DECL(type) type VBOXCALL
238#elif defined(IN_USBLIB)
239# define USBLIB_DECL(type) DECLEXPORT(type) VBOXCALL
240#else
241# define USBLIB_DECL(type) DECLIMPORT(type) VBOXCALL
242#endif
243
244
245
246/** @def IN_VMM_R3
247 * Used to indicate whether we're inside the same link module as the ring 3 part of the
248 * virtual machine monitor or not.
249 */
250/** @def VMMR3DECL
251 * Ring 3 VMM export or import declaration.
252 * @param type The return type of the function declaration.
253 */
254#ifdef IN_VMM_R3
255# define VMMR3DECL(type) DECLEXPORT(type) VBOXCALL
256#elif defined(IN_RING3)
257# define VMMR3DECL(type) DECLIMPORT(type) VBOXCALL
258#else
259# define VMMR3DECL(type) DECL_INVALID(type)
260#endif
261
262/** @def IN_VMM_R0
263 * Used to indicate whether we're inside the same link module as the ring 0 part of the
264 * virtual machine monitor or not.
265 */
266/** @def VMMR0DECL
267 * Ring 0 VMM export or import declaration.
268 * @param type The return type of the function declaration.
269 */
270#ifdef IN_VMM_R0
271# define VMMR0DECL(type) DECLEXPORT(type) VBOXCALL
272#elif defined(IN_RING0)
273# define VMMR0DECL(type) DECLIMPORT(type) VBOXCALL
274#else
275# define VMMR0DECL(type) DECL_INVALID(type)
276#endif
277
278/** @def IN_VMM_RC
279 * Used to indicate whether we're inside the same link module as the raw-mode
280 * context part of the virtual machine monitor or not.
281 */
282/** @def VMMRCDECL
283 * Raw-mode context VMM export or import declaration.
284 * @param type The return type of the function declaration.
285 */
286#ifdef IN_VMM_RC
287# define VMMRCDECL(type) DECLEXPORT(type) VBOXCALL
288#elif defined(IN_RC)
289# define VMMRCDECL(type) DECLIMPORT(type) VBOXCALL
290#else
291# define VMMRCDECL(type) DECL_INVALID(type)
292#endif
293
294/** @def VMMRZDECL
295 * Ring-0 and Raw-mode context VMM export or import declaration.
296 * @param type The return type of the function declaration.
297 */
298#if defined(IN_VMM_R0) || defined(IN_VMM_RC)
299# define VMMRZDECL(type) DECLEXPORT(type) VBOXCALL
300#elif defined(IN_RING0) || defined(IN_RZ)
301# define VMMRZDECL(type) DECLIMPORT(type) VBOXCALL
302#else
303# define VMMRZDECL(type) DECL_INVALID(type)
304#endif
305
306/** @def VMMDECL
307 * VMM export or import declaration.
308 * @param type The return type of the function declaration.
309 */
310#if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
311# define VMMDECL(type) DECLEXPORT(type) VBOXCALL
312#else
313# define VMMDECL(type) DECLIMPORT(type) VBOXCALL
314#endif
315
316/** @def VMM_INT_DECL
317 * VMM internal function.
318 * @param type The return type of the function declaration.
319 */
320#if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
321# define VMM_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
322#else
323# define VMM_INT_DECL(type) DECL_INVALID(type)
324#endif
325
326/** @def VMMR3_INT_DECL
327 * VMM internal function, ring-3.
328 * @param type The return type of the function declaration.
329 */
330#ifdef IN_VMM_R3
331# define VMMR3_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
332#else
333# define VMMR3_INT_DECL(type) DECL_INVALID(type)
334#endif
335
336/** @def VMMR0_INT_DECL
337 * VMM internal function, ring-0.
338 * @param type The return type of the function declaration.
339 */
340#ifdef IN_VMM_R0
341# define VMMR0_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
342#else
343# define VMMR0_INT_DECL(type) DECL_INVALID(type)
344#endif
345
346/** @def VMMRC_INT_DECL
347 * VMM internal function, raw-mode context.
348 * @param type The return type of the function declaration.
349 */
350#ifdef IN_VMM_RC
351# define VMMRC_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
352#else
353# define VMMRC_INT_DECL(type) DECL_INVALID(type)
354#endif
355
356/** @def VMMRZ_INT_DECL
357 * VMM internal function, ring-0 + raw-mode context.
358 * @param type The return type of the function declaration.
359 */
360#ifdef IN_VMM_RZ
361# define VMMRZ_INT_DECL(type) DECLHIDDEN(type) VBOXCALL
362#else
363# define VMMRZ_INT_DECL(type) DECL_INVALID(type)
364#endif
365
366
367
368/** @def IN_VBOXDDU
369 * Used to indicate whether we're inside the VBoxDDU shared object.
370 */
371/** @def VBOXDDU_DECL(type)
372 * VBoxDDU export or import (ring-3).
373 * @param type The return type of the function declaration.
374 */
375#ifdef IN_VBOXDDU
376# define VBOXDDU_DECL(type) DECLEXPORT(type) VBOXCALL
377#else
378# define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL
379#endif
380
381
382#endif
383
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette