Symbian3/SDK/Source/GUID-09D1DB3C-DA2D-4E16-8EEB-2195F765BE22.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-09D1DB3C-DA2D-4E16-8EEB-2195F765BE22" xml:lang="en"><title>Using
       
    13 Exported Global Variables for GLib</title><shortdesc>GLib on Linux has many global variables like <codeph>g_idle_funcs</codeph> exported
       
    14 from the <filepath>.so</filepath> file. Symbian platform does not support
       
    15 exporting global variables from the DLL. Therefore, the global variable of
       
    16 GLib cannot be exported and hence used directly.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    17 <p>The users must include the header <filepath>glib_global.h</filepath> for <codeph>libglib</codeph> global
       
    18 variables and <filepath>gobject_global.h</filepath> for <codeph>libgobject</codeph> global
       
    19 variables. The other two DLLs - <codeph>libgmodule</codeph> and <codeph>libgthread</codeph> -
       
    20 do not have any exported global variables.</p>
       
    21 <note>The header must be included only after all the other headers in the
       
    22 file.</note>
       
    23 <p>The following example code snippet explains the usage. This is a code that
       
    24 prints the version of GLib being used.</p>
       
    25 <p>The variables listed below are <codeph>libglib</codeph> global variables:</p>
       
    26 <ul>
       
    27 <li><p><codeph>glib_major_version</codeph></p></li>
       
    28 <li><p><codeph>glib_minor_version</codeph></p></li>
       
    29 <li><p><codeph>glib_micro_version</codeph></p></li>
       
    30 </ul>
       
    31 <codeblock xml:space="preserve">#include &lt;stdio.h&gt;
       
    32 #include &lt;glib.h&gt;
       
    33 #include &lt;glib_global.h&gt; // Always include as the last include 
       
    34 
       
    35 int main()
       
    36 {
       
    37     /* glib_major_version,glib_minor_version and 
       
    38      * glib_micro_version are libglib global variables
       
    39      */
       
    40     printf("The version of glib that you are using is %d.%d.%d",
       
    41             glib_major_version,glib_minor_version,glib_micro_version);
       
    42     getchar();
       
    43     return 0;
       
    44 }
       
    45 </codeblock>
       
    46 </conbody></concept>