VirtualBox

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

Last change on this file since 104429 was 98103, checked in by vboxsync, 20 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
RevLine 
[1]1/** @file
2 * VirtualBox - Common C and C++ definition.
3 */
4
5/*
[98103]6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
[1]7 *
[96407]8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
[5999]10 *
[96407]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 *
[5999]24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
[96407]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
[5999]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.
[96407]32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
[1]34 */
35
[76558]36#ifndef VBOX_INCLUDED_cdefs_h
37#define VBOX_INCLUDED_cdefs_h
[76507]38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
[1]41
42#include <iprt/cdefs.h>
43
44
[71606]45/** @defgroup grp_vbox_cdefs VBox Common Defintions and Macros
[58111]46 * @{
47 */
48
[1]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
[71606]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
[1]84
[71606]85
[1]86/*
87 * Shut up DOXYGEN warnings and guide it properly thru the code.
88 */
[25642]89#ifdef DOXYGEN_RUNNING
[1]90#define VBOX_WITH_STATISTICS
[12653]91#define VBOX_STRICT
[71609]92#define VBOX_STRICT_GUEST
93#define VBOX_NO_STRICT_GUEST
[25647]94#define IN_DBG
[12989]95#define IN_DIS
[1]96#define IN_INTNET_R0
97#define IN_INTNET_R3
[35855]98#define IN_PCIRAW_R0
99#define IN_PCIRAW_R3
[1]100#define IN_REM_R3
101#define IN_SUP_R0
102#define IN_SUP_R3
[26227]103#define IN_SUP_RC
[25647]104#define IN_SUP_STATIC
[5562]105#define IN_USBLIB
[12653]106#define IN_VBOXDDU
[12989]107#define IN_VMM_RC
[1]108#define IN_VMM_R0
109#define IN_VMM_R3
[25647]110#define IN_VMM_STATIC
[1]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
[12989]123/** @def IN_DIS
124 * Used to indicate whether we're inside the same link module as the
125 * disassembler.
[1]126 */
[12989]127/** @def DISDECL(type)
128 * Disassembly export or import declaration.
[1]129 * @param type The return type of the function declaration.
130 */
[12989]131#if defined(IN_DIS)
[66715]132# ifdef IN_DIS_STATIC
[85099]133# define DISDECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[66714]134# else
[85099]135# define DISDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[66714]136# endif
[1]137#else
[85099]138# define DISDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]139#endif
140
141
[12989]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).
[1]146 */
[12989]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.
[1]151 * @param type The return type of the function declaration.
152 */
[12989]153#if defined(IN_DBG_R3) || defined(IN_DBG)
[85099]154# define DBGDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]155#else
[85099]156# define DBGDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]157#endif
158
159
160
[12989]161/** @def IN_INTNET_R3
[26227]162 * Used to indicate whether we're inside the same link module as the Ring-3
[12989]163 * Internal Networking Service.
[1]164 */
[12989]165/** @def INTNETR3DECL(type)
166 * Internal Networking Service export or import declaration.
[1]167 * @param type The return type of the function declaration.
168 */
[12989]169#ifdef IN_INTNET_R3
[85099]170# define INTNETR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]171#else
[85099]172# define INTNETR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]173#endif
174
[12989]175/** @def IN_INTNET_R0
176 * Used to indicate whether we're inside the same link module as the R0
177 * Internal Network Service.
[1]178 */
[12989]179/** @def INTNETR0DECL(type)
180 * Internal Networking Service export or import declaration.
[1]181 * @param type The return type of the function declaration.
182 */
[12989]183#ifdef IN_INTNET_R0
[85099]184# define INTNETR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]185#else
[85099]186# define INTNETR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]187#endif
188
[35899]189
190
[35855]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
[85099]200# define PCIRAWR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[35855]201#else
[85099]202# define PCIRAWR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[35855]203#endif
[1]204
[35855]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
[85099]214# define PCIRAWR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[35855]215#else
[85099]216# define PCIRAWR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[35855]217#endif
[1]218
[35855]219
[35899]220
[12989]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.
[1]224 */
[12989]225/** @def REMR3DECL(type)
226 * Recompiled Execution Manager HC Ring-3 export or import declaration.
[1]227 * @param type The return type of the function declaration.
228 */
[12989]229#ifdef IN_REM_R3
[85099]230# define REMR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]231#else
[85099]232# define REMR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]233#endif
234
235
236
237/** @def IN_SUP_R3
[26227]238 * Used to indicate whether we're inside the same link module as the Ring-3
239 * Support Library or not.
[1]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
[49893]246# ifdef IN_SUP_STATIC
[85099]247# define SUPR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[49893]248# else
[85099]249# define SUPR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[49893]250# endif
[1]251#else
[49893]252# ifdef IN_SUP_STATIC
[85099]253# define SUPR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[49893]254# else
[85099]255# define SUPR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[49893]256# endif
[1]257#endif
258
259/** @def IN_SUP_R0
[26227]260 * Used to indicate whether we're inside the same link module as the Ring-0
[24577]261 * Support Library or not.
[1]262 */
[24577]263/** @def IN_SUP_STATIC
264 * Used to indicate that the Support Library is built or used as a static
265 * library.
266 */
[1]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
[11814]272# ifdef IN_SUP_STATIC
[85099]273# define SUPR0DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[11814]274# else
[85099]275# define SUPR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[11814]276# endif
[1]277#else
[11814]278# ifdef IN_SUP_STATIC
[85099]279# define SUPR0DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[11814]280# else
[85099]281# define SUPR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[11814]282# endif
[1]283#endif
284
[26227]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.
[1]288 */
[26227]289/** @def SUPRCDECL(type)
[1]290 * Support library export or import declaration.
291 * @param type The return type of the function declaration.
292 */
[26227]293#ifdef IN_SUP_RC
[85099]294# define SUPRCDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]295#else
[85099]296# define SUPRCDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]297#endif
298
299/** @def IN_SUP_R0
[26227]300 * Used to indicate whether we're inside the same link module as the Ring-0
301 * Support Library or not.
[1]302 */
303/** @def SUPR0DECL(type)
304 * Support library export or import declaration.
305 * @param type The return type of the function declaration.
306 */
[26227]307#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_RC)
[85099]308# define SUPDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]309#else
[85099]310# define SUPDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]311#endif
312
313
314
[5562]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)
[85099]325# define USBLIB_DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[5562]326#else
[85099]327# define USBLIB_DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[5562]328#endif
329
330
331
[24577]332/** @def IN_VMM_STATIC
333 * Used to indicate that the virtual machine monitor is built or used as a
334 * static library.
335 */
[12989]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.
[1]339 */
[12989]340/** @def VMMR3DECL
[26227]341 * Ring-3 VMM export or import declaration.
[1]342 * @param type The return type of the function declaration.
343 */
[12989]344#ifdef IN_VMM_R3
[24577]345# ifdef IN_VMM_STATIC
[85099]346# define VMMR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[24577]347# else
[85099]348# define VMMR3DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[24577]349# endif
[22802]350#elif defined(IN_RING3)
[24577]351# ifdef IN_VMM_STATIC
[85099]352# define VMMR3DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[24577]353# else
[85099]354# define VMMR3DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[24577]355# endif
[1]356#else
[22802]357# define VMMR3DECL(type) DECL_INVALID(type)
[1]358#endif
359
[12989]360/** @def IN_VMM_R0
[26227]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.
[1]363 */
[12989]364/** @def VMMR0DECL
[26227]365 * Ring-0 VMM export or import declaration.
[1]366 * @param type The return type of the function declaration.
367 */
[12989]368#ifdef IN_VMM_R0
[85099]369# define VMMR0DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[22802]370#elif defined(IN_RING0)
[85099]371# define VMMR0DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]372#else
[22802]373# define VMMR0DECL(type) DECL_INVALID(type)
[1]374#endif
375
[12989]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.
[1]379 */
[12989]380/** @def VMMRCDECL
[19287]381 * Raw-mode context VMM export or import declaration.
[1]382 * @param type The return type of the function declaration.
383 */
[12989]384#ifdef IN_VMM_RC
[85099]385# define VMMRCDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[22802]386#elif defined(IN_RC)
[85099]387# define VMMRCDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]388#else
[22802]389# define VMMRCDECL(type) DECL_INVALID(type)
[1]390#endif
391
[19287]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)
[85099]397# define VMMRZDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[22802]398#elif defined(IN_RING0) || defined(IN_RZ)
[85099]399# define VMMRZDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[19287]400#else
[22802]401# define VMMRZDECL(type) DECL_INVALID(type)
[19287]402#endif
403
[12989]404/** @def VMMDECL
405 * VMM export or import declaration.
[1]406 * @param type The return type of the function declaration.
407 */
[24577]408#ifdef IN_VMM_STATIC
[85099]409# define VMMDECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[24577]410#elif defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC)
[85099]411# define VMMDECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[1]412#else
[85099]413# define VMMDECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1]414#endif
415
[22802]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)
[85099]421# define VMM_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[22802]422#else
423# define VMM_INT_DECL(type) DECL_INVALID(type)
424#endif
[1]425
[22802]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
[85099]431# define VMMR3_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[22802]432#else
433# define VMMR3_INT_DECL(type) DECL_INVALID(type)
434#endif
[1]435
[22802]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
[85099]441# define VMMR0_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[22802]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
[85099]451# define VMMRC_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[22802]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 */
[44405]460#if defined(IN_VMM_RC) || defined(IN_VMM_R0)
[85099]461# define VMMRZ_INT_DECL(type) DECL_HIDDEN_NOTHROW(type) VBOXCALL
[22802]462#else
463# define VMMRZ_INT_DECL(type) DECL_INVALID(type)
464#endif
465
466
467
[1566]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
[31508]476# ifdef IN_VBOXDDU_STATIC
[85099]477# define VBOXDDU_DECL(type) type
[31508]478# else
[85099]479# define VBOXDDU_DECL(type) DECL_EXPORT_NOTHROW(type) VBOXCALL
[31508]480# endif
[1566]481#else
[85099]482# define VBOXDDU_DECL(type) DECL_IMPORT_NOTHROW(type) VBOXCALL
[1566]483#endif
[1]484
[58111]485/** @} */
[1566]486
[58111]487
488/** @defgroup grp_devdrv Device Emulations and Drivers
489 * @{ */
490/** @} */
491
[76585]492#endif /* !VBOX_INCLUDED_cdefs_h */
[1]493
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use