root/trunk/include/VBox/cdefs.h
| Revision 12989, 8.8 kB (checked in by vboxsync, 2 months ago) | |
|---|---|
| |
| 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 | #else |
| 257 | # define VMMR3DECL(type) DECLIMPORT(type) VBOXCALL |
| 258 | #endif |
| 259 | |
| 260 | /** @def IN_VMM_R0 |
| 261 | * Used to indicate whether we're inside the same link module as the ring 0 part of the |
| 262 | * virtual machine monitor or not. |
| 263 | */ |
| 264 | /** @def VMMR0DECL |
| 265 | * Ring 0 VMM export or import declaration. |
| 266 | * @param type The return type of the function declaration. |
| 267 | */ |
| 268 | #ifdef IN_VMM_R0 |
| 269 | # define VMMR0DECL(type) DECLEXPORT(type) VBOXCALL |
| 270 | #else |
| 271 | # define VMMR0DECL(type) DECLIMPORT(type) VBOXCALL |
| 272 | #endif |
| 273 | |
| 274 | /** @def IN_VMM_RC |
| 275 | * Used to indicate whether we're inside the same link module as the raw-mode |
| 276 | * context part of the virtual machine monitor or not. |
| 277 | */ |
| 278 | /** @def VMMRCDECL |
| 279 | * Guest context VMM export or import declaration. |
| 280 | * @param type The return type of the function declaration. |
| 281 | */ |
| 282 | #ifdef IN_VMM_RC |
| 283 | # define VMMRCDECL(type) DECLEXPORT(type) VBOXCALL |
| 284 | #else |
| 285 | # define VMMRCDECL(type) DECLIMPORT(type) VBOXCALL |
| 286 | #endif |
| 287 | |
| 288 | /** @def VMMDECL |
| 289 | * VMM export or import declaration. |
| 290 | * @param type The return type of the function declaration. |
| 291 | */ |
| 292 | #if defined(IN_VMM_R3) || defined(IN_VMM_R0) || defined(IN_VMM_RC) |
| 293 | # define VMMDECL(type) DECLEXPORT(type) VBOXCALL |
| 294 | #else |
| 295 | # define VMMDECL(type) DECLIMPORT(type) VBOXCALL |
| 296 | #endif |
| 297 | |
| 298 | |
| 299 | |
| 300 | /** @def IN_VBOXDDU |
| 301 | * Used to indicate whether we're inside the VBoxDDU shared object. |
| 302 | */ |
| 303 | /** @def VBOXDDU_DECL(type) |
| 304 | * VBoxDDU export or import (ring-3). |
| 305 | * @param type The return type of the function declaration. |
| 306 | */ |
| 307 | #ifdef IN_VBOXDDU |
| 308 | # define VBOXDDU_DECL(type) DECLEXPORT(type) VBOXCALL |
| 309 | #else |
| 310 | # define VBOXDDU_DECL(type) DECLIMPORT(type) VBOXCALL |
| 311 | #endif |
| 312 | |
| 313 | |
| 314 | |
| 315 | /** @def NOT_DMIK(expr) |
| 316 | * Turns the given expression into NOOP when DEBUG_dmik is defined. Evaluates |
| 317 | * the expression normally otherwise. |
| 318 | * @param expr Expression to guard. |
| 319 | */ |
| 320 | #if defined(DEBUG_dmik) |
| 321 | # define NOT_DMIK(expr) do { } while (0) |
| 322 | #else |
| 323 | # define NOT_DMIK(expr) expr |
| 324 | #endif |
| 325 | |
| 326 | |
| 327 | #endif |
| 328 |
Note: See TracBrowser for help on using the browser.

