VirtualBox

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

Last change on this file since 103224 was 98103, checked in by vboxsync, 21 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.7 KB
Line 
1/** @file
2 * VirtualBox - Common C and C++ definition.
3 */
4
5/*
6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_cdefs_h
37#define VBOX_INCLUDED_cdefs_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/cdefs.h>
43
44
45/** @defgroup grp_vbox_cdefs VBox Common Defintions and Macros
46 * @{
47 */
48
49/** @def VBOX_WITH_STATISTICS
50 * When defined all statistics will be included in the build.
51 * This is enabled by default in all debug builds.
52 */
53#ifndef VBOX_WITH_STATISTICS
54# ifdef DEBUG
55# define VBOX_WITH_STATISTICS
56# endif
57#endif
58
59/** @def VBOX_STRICT
60 * Alias for RT_STRICT.
61 */
62#ifdef RT_STRICT
63# ifndef VBOX_STRICT
64# define VBOX_STRICT
65# endif
66#endif
67
68/** @def VBOX_STRICT_GUEST
69 * Be strict on guest input. This can be overriden on the compiler command line
70 * or per source file by defining VBOX_NO_STRICT_GUEST.
71 *
72 * @sa VBox/assert.h and its ASSERT_GUEST_XXXX macros.
73 */
74#ifndef VBOX_STRICT_GUEST
75# ifdef VBOX_STRICT
76# define VBOX_STRICT_GUEST
77# endif
78#endif
79/** @def VBOX_NO_STRICT_GUEST
80 * Define to override VBOX_STRICT_GUEST, disabling asserting on guest input. */
81#ifdef VBOX_NO_STRICT_GUEST
82# undef VBOX_STRICT_GUEST
83#endif
84
85
86/*
87 * Shut up DOXYGEN warnings and guide it properly thru the code.
88 */
89#ifdef DOXYGEN_RUNNING
90#define VBOX_WITH_STATISTICS
91#define VBOX_STRICT
92#define VBOX_STRICT_GUEST
93#define VBOX_NO_STRICT_GUEST
94#define IN_DBG
95#define IN_DIS
96#define IN_INTNET_R0
97#define IN_INTNET_R3
98#define IN_PCIRAW_R0
99#define IN_PCIRAW_R3
100#define IN_REM_R3
101#define IN_SUP_R0
102#define IN_SUP_R3
103#define IN_SUP_RC
104#define IN_SUP_STATIC
105#define IN_USBLIB
106#define IN_VBOXDDU
107#define IN_VMM_RC
108#define IN_VMM_R0
109#define IN_VMM_R3
110#define IN_VMM_STATIC
111#endif
112
113
114
115
116/** @def VBOXCALL
117 * The standard calling convention for VBOX interfaces.
118 */
119#define VBOXCALL RTCALL
120
121
122
123/** @def IN_DIS
124 * Used to indicate whether we're inside the same link module as the
125 * disassembler.
126 */
127/** @def DISDECL(type)
128 * Disassembly export or import declaration.
129 * @param type The return type of the function declaration.
130 */
131#if defined(IN_DIS)
132# ifdef IN_DIS_STATIC
133# define DISDECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
134# else
135# define DISDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
136# endif
137#else
138# define DISDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
139#endif
140
141
142
143/** @def IN_DBG
144 * Used to indicate whether we're inside the same link module as the debugger
145 * console, gui, and related things (ring-3).
146 */
147/** @def DBGDECL(type)
148 * Debugger module export or import declaration.
149 * Functions declared using this exists only in R3 since the
150 * debugger modules is R3 only.
151 * @param type The return type of the function declaration.
152 */
153#if defined(IN_DBG_R3) || defined(IN_DBG)
154# define DBGDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
155#else
156# define DBGDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
157#endif
158
159
160
161/** @def IN_INTNET_R3
162 * Used to indicate whether we're inside the same link module as the Ring-3
163 * Internal Networking Service.
164 */
165/** @def INTNETR3DECL(type)
166 * Internal Networking Service export or import declaration.
167 * @param type The return type of the function declaration.
168 */
169#ifdef IN_INTNET_R3
170# define INTNETR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
171#else
172# define INTNETR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
173#endif
174
175/** @def IN_INTNET_R0
176 * Used to indicate whether we're inside the same link module as the R0
177 * Internal Network Service.
178 */
179/** @def INTNETR0DECL(type)
180 * Internal Networking Service export or import declaration.
181 * @param type The return type of the function declaration.
182 */
183#ifdef IN_INTNET_R0
184# define INTNETR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
185#else
186# define INTNETR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
187#endif
188
189
190
191/** @def IN_PCIRAW_R3
192 * Used to indicate whether we're inside the same link module as the Ring-3
193 * PCI passthrough support.
194 */
195/** @def PCIRAWR3DECL(type)
196 * PCI passthrough export or import declaration.
197 * @param type The return type of the function declaration.
198 */
199#ifdef IN_PCIRAW_R3
200# define PCIRAWR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
201#else
202# define PCIRAWR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
203#endif
204
205/** @def IN_PCIRAW_R0
206 * Used to indicate whether we're inside the same link module as the R0
207 * PCI passthrough support.
208 */
209/** @def PCIRAWR0DECL(type)
210 * PCI passthroug export or import declaration.
211 * @param type The return type of the function declaration.
212 */
213#ifdef IN_PCIRAW_R0
214# define PCIRAWR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
215#else
216# define PCIRAWR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
217#endif
218
219
220
221/** @def IN_REM_R3
222 * Used to indicate whether we're inside the same link module as
223 * the HC Ring-3 Recompiled Execution Manager.
224 */
225/** @def REMR3DECL(type)
226 * Recompiled Execution Manager HC Ring-3 export or import declaration.
227 * @param type The return type of the function declaration.
228 */
229#ifdef IN_REM_R3
230# define REMR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
231#else
232# define REMR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
233#endif
234
235
236
237/** @def IN_SUP_R3
238 * Used to indicate whether we're inside the same link module as the Ring-3
239 * Support Library or not.
240 */
241/** @def SUPR3DECL(type)
242 * Support library export or import declaration.
243 * @param type The return type of the function declaration.
244 */
245#ifdef IN_SUP_R3
246# ifdef IN_SUP_STATIC
247# define SUPR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
248# else
249# define SUPR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
250# endif
251#else
252# ifdef IN_SUP_STATIC
253# define SUPR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
254# else
255# define SUPR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
256# endif
257#endif
258
259/** @def IN_SUP_R0
260 * Used to indicate whether we're inside the same link module as the Ring-0
261 * Support Library or not.
262 */
263/** @def IN_SUP_STATIC
264 * Used to indicate that the Support Library is built or used as a static
265 * library.
266 */
267/** @def SUPR0DECL(type)
268 * Support library export or import declaration.
269 * @param type The return type of the function declaration.
270 */
271#ifdef IN_SUP_R0
272# ifdef IN_SUP_STATIC
273# define SUPR0DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
274# else
275# define SUPR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
276# endif
277#else
278# ifdef IN_SUP_STATIC
279# define SUPR0DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
280# else
281# define SUPR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
282# endif
283#endif
284
285/** @def IN_SUP_RC
286 * Used to indicate whether we're inside the same link module as the RC Support
287 * Library or not.
288 */
289/** @def SUPRCDECL(type)
290 * Support library export or import declaration.
291 * @param type The return type of the function declaration.
292 */
293#ifdef IN_SUP_RC
294# define SUPRCDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
295#else
296# define SUPRCDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
297#endif
298
299/** @def IN_SUP_R0
300 * Used to indicate whether we're inside the same link module as the Ring-0
301 * Support Library or not.
302 */
303/** @def SUPR0DECL(type)
304 * Support library export or import declaration.
305 * @param type The return type of the function declaration.
306 */
307#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
308# define SUPDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
309#else
310# define SUPDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
311#endif
312
313
314
315/** @def IN_USBLIB
316 * Used to indicate whether we're inside the same link module as the USBLib.
317 */
318/** @def USBLIB_DECL
319 * USBLIB export or import declaration.
320 * @param type The return type of the function declaration.
321 */
322#ifdef IN_RING0
323# define USBLIB_DECL(type) type VBOXCALL
324#elif defined(IN_USBLIB)
325# define USBLIB_DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
326#else
327# define USBLIB_DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
328#endif
329
330
331
332/** @def IN_VMM_STATIC
333 * Used to indicate that the virtual machine monitor is built or used as a
334 * static library.
335 */
336/** @def IN_VMM_R3
337 * Used to indicate whether we're inside the same link module as the ring 3 part of the
338 * virtual machine monitor or not.
339 */
340/** @def VMMR3DECL
341 * Ring-3 VMM export or import declaration.
342 * @param type The return type of the function declaration.
343 */
344#ifdef IN_VMM_R3
345# ifdef IN_VMM_STATIC
346# define VMMR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
347# else
348# define VMMR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
349# endif
350#elif defined(IN_RING3)
351# ifdef IN_VMM_STATIC
352# define VMMR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
353# else
354# define VMMR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
355# endif
356#else
357# define VMMR3DECL(type) DECL_INVALID(type)
358#endif
359
360/** @def IN_VMM_R0
361 * Used to indicate whether we're inside the same link module as the ring-0 part
362 * of the virtual machine monitor or not.
363 */
364/** @def VMMR0DECL
365 * Ring-0 VMM export or import declaration.
366 * @param type The return type of the function declaration.
367 */
368#ifdef IN_VMM_R0
369# define VMMR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
370#elif defined(IN_RING0)
371# define VMMR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
372#else
373# define VMMR0DECL(type) DECL_INVALID(type)
374#endif
375
376/** @def IN_VMM_RC
377 * Used to indicate whether we're inside the same link module as the raw-mode
378 * context part of the virtual machine monitor or not.
379 */
380/** @def VMMRCDECL
381 * Raw-mode context VMM export or import declaration.
382 * @param type The return type of the function declaration.
383 */
384#ifdef IN_VMM_RC
385# define VMMRCDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
386#elif defined(IN_RC)
387# define VMMRCDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
388#else
389# define VMMRCDECL(type) DECL_INVALID(type)
390#endif
391
392/** @def VMMRZDECL
393 * Ring-0 and Raw-mode context VMM export or import declaration.
394 * @param type The return type of the function declaration.
395 */
396#if defined(IN_VMM_R0) || defined(IN_VMM_RC)
397# define VMMRZDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
398#elif defined(IN_RING0) || defined(IN_RZ)
399# define VMMRZDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
400#else
401# define VMMRZDECL(type) DECL_INVALID(type)
402#endif
403
404/** @def VMMDECL
405 * VMM export or import declaration.
406 * @param type The return type of the function declaration.
407 */
408#ifdef IN_VMM_STATIC
409# define VMMDECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
410#elif defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
411# define VMMDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
412#else
413# define VMMDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
414#endif
415
416/** @def VMM_INT_DECL
417 * VMM internal function.
418 * @param type The return type of the function declaration.
419 */
420#if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
421# define VMM_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
422#else
423# define VMM_INT_DECL(type) DECL_INVALID(type)
424#endif
425
426/** @def VMMR3_INT_DECL
427 * VMM internal function, ring-3.
428 * @param type The return type of the function declaration.
429 */
430#ifdef IN_VMM_R3
431# define VMMR3_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
432#else
433# define VMMR3_INT_DECL(type) DECL_INVALID(type)
434#endif
435
436/** @def VMMR0_INT_DECL
437 * VMM internal function, ring-0.
438 * @param type The return type of the function declaration.
439 */
440#ifdef IN_VMM_R0
441# define VMMR0_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
442#else
443# define VMMR0_INT_DECL(type) DECL_INVALID(type)
444#endif
445
446/** @def VMMRC_INT_DECL
447 * VMM internal function, raw-mode context.
448 * @param type The return type of the function declaration.
449 */
450#ifdef IN_VMM_RC
451# define VMMRC_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
452#else
453# define VMMRC_INT_DECL(type) DECL_INVALID(type)
454#endif
455
456/** @def VMMRZ_INT_DECL
457 * VMM internal function, ring-0 + raw-mode context.
458 * @param type The return type of the function declaration.
459 */
460#if defined(IN_VMM_RC) || defined(IN_VMM_R0)
461# define VMMRZ_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
462#else
463# define VMMRZ_INT_DECL(type) DECL_INVALID(type)
464#endif
465
466
467
468/** @def IN_VBOXDDU
469 * Used to indicate whether we're inside the VBoxDDU shared object.
470 */
471/** @def VBOXDDU_DECL(type)
472 * VBoxDDU export or import (ring-3).
473 * @param type The return type of the function declaration.
474 */
475#ifdef IN_VBOXDDU
476# ifdef IN_VBOXDDU_STATIC
477# define VBOXDDU_DECL(type) type
478# else
479# define VBOXDDU_DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
480# endif
481#else
482# define VBOXDDU_DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
483#endif
484
485/** @} */
486
487
488/** @defgroup grp_devdrv Device Emulations and Drivers
489 * @{ */
490/** @} */
491
492#endif /* !VBOX_INCLUDED_cdefs_h */
493
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