VirtualBox

Changeset 49525 in vbox for trunk/doc/manual/en_US


Ignore:
Timestamp:
Nov 18, 2013 12:25:40 PM (11 years ago)
Author:
vboxsync
Message:

manual/SDKRef: touch up the C binding documentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r49313 r49525  
    17221722
    17231723        <note>
    1724           <para>This section currently applies to Linux hosts only.</para>
     1724          <para>This section currently applies to Linux, Mac OS X and Solaris
     1725          hosts only.</para>
    17251726        </note>
    17261727
     
    17371738          C program.</para>
    17381739
    1739           <para>For Linux, a sample program is provided which demonstrates use
    1740           of the C binding to initialize XPCOM, get handles for VirtualBox and
    1741           Session objects, make calls to list and start virtual machines, and
    1742           uninitialize resources when done. The program uses the VBoxGlue
    1743           library to open the C binding layer during runtime.</para>
     1740          <para>As part of the SDK, a sample program is provided which
     1741          demonstrates using the C binding to initialize XPCOM, get handles for
     1742          VirtualBox and Session objects, make calls to list and start virtual
     1743          machines, monitor events, and uninitialize resources when done. The
     1744          program uses the VBoxGlue library to open the C binding layer during
     1745          runtime.</para>
    17441746
    17451747          <para>The sample program
     
    17581760
    17591761          <para>Just like in C++, XPCOM needs to be initialized before it can
    1760           be used. The <computeroutput>VBoxCAPI_v2_5.h</computeroutput> header
     1762          be used. The <computeroutput>VBoxCAPI_v4_3.h</computeroutput> header
    17611763          provides the interface to the C binding. Here's how to initialize
    17621764          XPCOM:</para>
    17631765
    1764           <screen>#include "VBoxCAPI_v2_5.h"
     1766          <screen>#include "VBoxCAPI_v4_3.h"
    17651767...
    17661768PCVBOXXPCOM g_pVBoxFuncs = NULL;
     
    17841786
    17851787g_pVBoxFuncs = VBoxGetXPCOMCFunctions(VBOX_XPCOMC_VERSION);
    1786 g_pVBoxFuncs-&gt;pfnComInitialize(&amp;vbox, &amp;session);</screen>
     1788g_pVBoxFuncs-&gt;pfnComInitialize(IVIRTUALBOX_IID_STR, &amp;vbox,
     1789                               ISESSION_IID_STR, &amp;session);</screen>
    17871790
    17881791          <para>If either <computeroutput>vbox</computeroutput> or
     
    17901793          <computeroutput>NULL</computeroutput>, initialization failed and the
    17911794          XPCOM API cannot be used.</para>
     1795
     1796          <para>There is now also a way to use the
     1797          <xref linkend="IVirtualBoxClient" xreflabel="IVirtualBoxClient" />
     1798          helper interface, which in comparison to the original (and still
     1799          available) initialization method above simplifies creating multiple
     1800          sessions, and also allows handling termination and crashes of the API
     1801          server (VBoxSVC) in a graceful way. See the sample program how this
     1802          is used.</para>
    17921803        </sect3>
    17931804
     
    18861897          take pointers to that type. Prototypes for the following conversion
    18871898          functions are declared in
    1888           <computeroutput>VBoxCAPI_v2_5.h</computeroutput>.</para>
     1899          <computeroutput>VBoxCAPI_v4_3.h</computeroutput>.</para>
    18891900
    18901901          <sect4>
     
    19461957          calling
    19471958          <computeroutput>g_pVBoxFuncs-&gt;pfnComUninitialize()</computeroutput>
    1948           later on (usually <emphasis>not</emphasis> from the handler itself
    1949           .)</para>
     1959          later on, <emphasis>not</emphasis> from the handler itself.</para>
    19501960
    19511961          <para>That said, if a client program forgets to call
    19521962          <computeroutput>g_pVBoxFuncs-&gt;pfnComUninitialize()</computeroutput>
    19531963          before it terminates, there is a mechanism in place which will
    1954           eventually release references held by the client. You should not
    1955           rely on this, however.</para>
     1964          eventually release references held by the client.</para>
    19561965        </sect3>
    19571966
     
    19761985
    19771986# Compile.
    1978 program.o: program.c VBoxCAPI_v2_5.h
     1987program.o: program.c VBoxCAPI_v4_3.h
    19791988    $(CC) $(CFLAGS) $(INCS_XPCOM) $(GLUE_INC) -o $@ -c $&lt;
    19801989
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