VirtualBox

source: vbox/trunk/src/VBox/Main/cbinding/cbinding.h@ 17282

Last change on this file since 17282 was 16833, checked in by vboxsync, 16 years ago

cbinding: Moved MOZ_UNICODE into the cbinding.h header.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1/* $Revision: 16833 $ */
2/** @file cbinding.h
3 * C binding for XPCOM.
4 */
5
6/*
7 * Copyright (C) 2009 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#ifndef ___VBoxXPCOMC_cbinding_h
23#define ___VBoxXPCOMC_cbinding_h
24
25#ifndef MOZ_UNICODE
26# define MOZ_UNICODE
27#endif
28
29#ifdef __cplusplus
30# include "VirtualBox_XPCOM.h"
31#else
32# include "VirtualBox_CXPCOM.h"
33#endif
34
35#ifdef IN_VBOXXPCOMC
36# define VBOXXPCOMC_DECL(type) PR_EXPORT(type)
37#else
38# define VBOXXPCOMC_DECL(type) PR_IMPORT(type)
39#endif
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45/* Initialize/Uninitialize XPCOM. */
46VBOXXPCOMC_DECL(void) VBoxComInitialize(IVirtualBox **virtualBox, ISession **session);
47VBOXXPCOMC_DECL(void) VBoxComUninitialize(void);
48
49/* Deallocation functions. */
50VBOXXPCOMC_DECL(void) VBoxComUnallocMem(void *ptr);
51VBOXXPCOMC_DECL(void) VBoxUtf16Free(PRUnichar *pwszString);
52VBOXXPCOMC_DECL(void) VBoxUtf8Free(char *pszString);
53
54/* Converting to and from UTF-8 and UTF-16. */
55VBOXXPCOMC_DECL(int) VBoxUtf16ToUtf8(const PRUnichar *pwszString, char **ppszString);
56VBOXXPCOMC_DECL(int) VBoxUtf8ToUtf16(const char *pszString, PRUnichar **ppwszString);
57
58/* Getting and setting the environment variables. */
59VBOXXPCOMC_DECL(const char *) VBoxGetEnv(const char *pszVar);
60VBOXXPCOMC_DECL(int) VBoxSetEnv(const char *pszVar, const char *pszValue);
61
62
63/**
64 * Function table for dynamic linking.
65 * Use VBoxGetFunctions() to obtain the pointer to it.
66 */
67typedef struct VBOXXPCOMC
68{
69 /** The size of the structure. */
70 unsigned cb;
71 /** The structure version. */
72 unsigned uVersion;
73 void (*pfnComInitialize)(IVirtualBox **virtualBox, ISession **session);
74 void (*pfnComUninitialize)(void);
75
76 void (*pfnComUnallocMem)(void *pv);
77 void (*pfnUtf16Free)(PRUnichar *pwszString);
78 void (*pfnUtf8Free)(char *pszString);
79
80 int (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
81 int (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
82
83 const char * (*pfnGetEnv)(const char *pszVar);
84 int (*pfnSetEnv)(const char *pszVar, const char *pszValue);
85 /** Tail version, same as uVersion. */
86 unsigned uEndVersion;
87} VBOXXPCOMC;
88/** Pointer to a const VBoxXPCOMC function table. */
89typedef VBOXXPCOMC const *PCVBOXXPCOM;
90
91/** The current interface version.
92 * For use with VBoxGetXPCOMCFunctions and to be found in
93 * VBOXXPCOMC::uVersion. */
94#define VBOX_XPCOMC_VERSION 0x00010000U
95
96VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
97/** Typedef for VBoxGetXPCOMCFunctions. */
98typedef PCVBOXXPCOM (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
99
100/** The symbol name of VBoxGetXPCOMCFunctions. */
101#if defined(__APPLE__) || defined(__OS2__)
102# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "_VBoxGetXPCOMCFunctions"
103#else
104# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME "VBoxGetXPCOMCFunctions"
105#endif
106
107
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* !___VBoxXPCOMC_cbinding_h */
113
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