VirtualBox

Changeset 16832 in vbox for trunk/src


Ignore:
Timestamp:
Feb 17, 2009 12:36:30 PM (16 years ago)
Author:
vboxsync
Message:

VBoxXPCOMCGlue and VBoxGetXPCOMCFunctions.

Location:
trunk/src/VBox/Main/cbinding
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/cbinding/Makefile.kmk

    r16716 r16832  
    6262        VBoxXPCOMC.cpp
    6363
     64 #
     65 # The C glue library.
     66 #
     67 LIBRARIES.linux += VBoxXPCOMCGlue
     68 VBoxXPCOMCGlue_TEMPLATE = VBOXMAINEXE
     69 VBoxXPCOMCGlue_DEFS = MOZ_UNICODE IN_VBOXXPCOMC
     70 VBoxXPCOMCGlue_SOURCES = \
     71        VBoxXPCOMCGlue.c
     72
    6473 ifdef VBOX_WITH_TESTCASES
    6574  #
  • trunk/src/VBox/Main/cbinding/VBoxXPCOMC.cpp

    r16689 r16832  
    154154}
    155155
     156
     157VBOXXPCOMC_DECL(PCVBOXXPCOM)
     158VBoxGetXPCOMCFunctions(unsigned uVersion)
     159{
     160    /* The current version. */
     161    static const VBOXXPCOMC s_Functions =
     162    {
     163        sizeof(VBOXXPCOMC),
     164        VBOX_XPCOMC_VERSION,
     165
     166        VBoxComInitialize,
     167        VBoxComUninitialize,
     168
     169        VBoxComUnallocMem,
     170        VBoxUtf16Free,
     171        VBoxUtf8Free,
     172
     173        VBoxUtf16ToUtf8,
     174        VBoxUtf8ToUtf16,
     175
     176        VBoxGetEnv,
     177        VBoxSetEnv,
     178
     179        VBOX_XPCOMC_VERSION
     180    };
     181
     182    if ((uVersion & 0xffff0000U) != VBOX_XPCOMC_VERSION)
     183        return NULL; /* not supported. */
     184
     185    return &s_Functions;
     186}
     187
    156188/* vim: set ts=4 sw=4 et: */
  • trunk/src/VBox/Main/cbinding/cbinding.h

    r16729 r16832  
    5656VBOXXPCOMC_DECL(int) VBoxSetEnv(const char *pszVar, const char *pszValue);
    5757
     58
     59/**
     60 * Function table for dynamic linking.
     61 * Use VBoxGetFunctions() to obtain the pointer to it.
     62 */
     63typedef struct VBOXXPCOMC
     64{
     65    /** The size of the structure. */
     66    unsigned cb;
     67    /** The structure version. */
     68    unsigned uVersion;
     69    void  (*pfnComInitialize)(IVirtualBox **virtualBox, ISession **session);
     70    void  (*pfnComUninitialize)(void);
     71
     72    void  (*pfnComUnallocMem)(void *pv);
     73    void  (*pfnUtf16Free)(PRUnichar *pwszString);
     74    void  (*pfnUtf8Free)(char *pszString);
     75
     76    int   (*pfnUtf16ToUtf8)(const PRUnichar *pwszString, char **ppszString);
     77    int   (*pfnUtf8ToUtf16)(const char *pszString, PRUnichar **ppwszString);
     78
     79    const char * (*pfnGetEnv)(const char *pszVar);
     80    int   (*pfnSetEnv)(const char *pszVar, const char *pszValue);
     81    /** Tail version, same as uVersion. */
     82    unsigned uEndVersion;
     83} VBOXXPCOMC;
     84/** Pointer to a const VBoxXPCOMC function table. */
     85typedef VBOXXPCOMC const *PCVBOXXPCOM;
     86
     87/** The current interface version.
     88 * For use with VBoxGetXPCOMCFunctions and to be found in
     89 * VBOXXPCOMC::uVersion. */
     90#define VBOX_XPCOMC_VERSION     0x00010000U
     91
     92VBOXXPCOMC_DECL(PCVBOXXPCOM) VBoxGetXPCOMCFunctions(unsigned uVersion);
     93/** Typedef for VBoxGetXPCOMCFunctions. */
     94typedef PCVBOXXPCOM (*PFNVBOXGETXPCOMCFUNCTIONS)(unsigned uVersion);
     95
     96/** The symbol name of VBoxGetXPCOMCFunctions. */
     97#if defined(__APPLE__) || defined(__OS2__)
     98# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME   "_VBoxGetXPCOMCFunctions"
     99#else
     100# define VBOX_GET_XPCOMC_FUNCTIONS_SYMBOL_NAME   "VBoxGetXPCOMCFunctions"
     101#endif
     102
     103
    58104#ifdef __cplusplus
    59105}
Note: See TracChangeset for help on using the changeset viewer.

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