Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-09D1DB3C-DA2D-4E16-8EEB-2195F765BE22" xml:lang="en"><title>Using
Exported Global Variables for GLib</title><shortdesc>GLib on Linux has many global variables like <codeph>g_idle_funcs</codeph> exported
from the <filepath>.so</filepath> file. Symbian platform does not support
exporting global variables from the DLL. Therefore, the global variable of
GLib cannot be exported and hence used directly.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The users must include the header <filepath>glib_global.h</filepath> for <codeph>libglib</codeph> global
variables and <filepath>gobject_global.h</filepath> for <codeph>libgobject</codeph> global
variables. The other two DLLs - <codeph>libgmodule</codeph> and <codeph>libgthread</codeph> -
do not have any exported global variables.</p>
<note>The header must be included only after all the other headers in the
file.</note>
<p>The following example code snippet explains the usage. This is a code that
prints the version of GLib being used.</p>
<p>The variables listed below are <codeph>libglib</codeph> global variables:</p>
<ul>
<li><p><codeph>glib_major_version</codeph></p></li>
<li><p><codeph>glib_minor_version</codeph></p></li>
<li><p><codeph>glib_micro_version</codeph></p></li>
</ul>
<codeblock xml:space="preserve">#include <stdio.h>
#include <glib.h>
#include <glib_global.h> // Always include as the last include
int main()
{
/* glib_major_version,glib_minor_version and
* glib_micro_version are libglib global variables
*/
printf("The version of glib that you are using is %d.%d.%d",
glib_major_version,glib_minor_version,glib_micro_version);
getchar();
return 0;
}
</codeblock>
</conbody></concept>