<refentry id="glib-Version-Information">
<refmeta>
<refentrytitle role="top_of_page" id="glib-Version-Information.top_of_page">Version Information</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Version Information</refname>
<refpurpose>Variables and functions to check the GLib version</refpurpose>
</refnamediv>

<refsynopsisdiv id="glib-Version-Information.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;glib.h&gt;

extern              const guint <link linkend="glib-major-version">glib_major_version</link>;
extern              const guint <link linkend="glib-minor-version">glib_minor_version</link>;
extern              const guint <link linkend="glib-micro-version">glib_micro_version</link>;
extern              const guint <link linkend="glib-binary-age">glib_binary_age</link>;
extern              const guint <link linkend="glib-interface-age">glib_interface_age</link>;
const <link linkend="gchar">gchar</link> *       <link linkend="glib-check-version">glib_check_version</link>                  (<link linkend="guint">guint</link> required_major,
                                                         <link linkend="guint">guint</link> required_minor,
                                                         <link linkend="guint">guint</link> required_micro);

#define             <link linkend="GLIB-MAJOR-VERSION--CAPS">GLIB_MAJOR_VERSION</link>
#define             <link linkend="GLIB-MINOR-VERSION--CAPS">GLIB_MINOR_VERSION</link>
#define             <link linkend="GLIB-MICRO-VERSION--CAPS">GLIB_MICRO_VERSION</link>
#define             <link linkend="GLIB-CHECK-VERSION--CAPS">GLIB_CHECK_VERSION</link>                  (major,minor,micro)
</synopsis>
</refsynopsisdiv>









<refsect1 id="glib-Version-Information.description" role="desc">
<title role="desc.title">Description</title>
<para>
GLib provides version information, primarily useful in configure checks
for builds that have a configure script. Applications will not
typically use the features described here.
</para>
</refsect1>

<refsect1 id="glib-Version-Information.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="glib-major-version" role="variable">
<title>glib_major_version</title>
<indexterm zone="glib-major-version"><primary sortas="lib_major_version">glib_major_version</primary></indexterm><programlisting>extern const guint glib_major_version;
</programlisting>
<para>
The major version number of the GLib library.
(e.g. in GLib version 1.2.5 this is 1.)
</para>
<para>
This variable is in the library, so represents the
GLib library you have linked against. Contrast with the
<link linkend="GLIB-MAJOR-VERSION--CAPS"><type>GLIB_MAJOR_VERSION</type></link> macro, which represents the major version of the
GLib headers you have included.
</para></refsect2>
<refsect2 id="glib-minor-version" role="variable">
<title>glib_minor_version</title>
<indexterm zone="glib-minor-version"><primary sortas="lib_minor_version">glib_minor_version</primary></indexterm><programlisting>extern const guint glib_minor_version;
</programlisting>
<para>
The minor version number of the GLib library.
(e.g. in GLib version 1.2.5 this is 2.)
</para>
<para>
This variable is in the library, so represents the
GLib library you have linked against. Contrast with the
<link linkend="GLIB-MINOR-VERSION--CAPS"><type>GLIB_MINOR_VERSION</type></link> macro, which represents the minor version of the
GLib headers you have included.
</para></refsect2>
<refsect2 id="glib-micro-version" role="variable">
<title>glib_micro_version</title>
<indexterm zone="glib-micro-version"><primary sortas="lib_micro_version">glib_micro_version</primary></indexterm><programlisting>extern const guint glib_micro_version;
</programlisting>
<para>
The micro version number of the GLib library.
(e.g. in GLib version 1.2.5 this is 5.)
</para>
<para>
This variable is in the library, so represents the GLib library you
have linked against. Contrast with the <link linkend="GLIB-MICRO-VERSION--CAPS"><type>GLIB_MICRO_VERSION</type></link> macro, which
represents the micro version of the GLib headers you have included.
</para></refsect2>
<refsect2 id="glib-binary-age" role="variable">
<title>glib_binary_age</title>
<indexterm zone="glib-binary-age"><primary sortas="lib_binary_age">glib_binary_age</primary></indexterm><programlisting>extern const guint glib_binary_age;
</programlisting>
<para>
This is the binary age passed to <application>libtool</application>. If
<application>libtool</application> means nothing to you, don't worry
about it. ;-)
</para></refsect2>
<refsect2 id="glib-interface-age" role="variable">
<title>glib_interface_age</title>
<indexterm zone="glib-interface-age"><primary sortas="lib_interface_age">glib_interface_age</primary></indexterm><programlisting>extern const guint glib_interface_age;
</programlisting>
<para>
This is the interface age passed to <application>libtool</application>. If
<application>libtool</application> means nothing to you, don't worry
about it. ;-)
</para></refsect2>
<refsect2 id="glib-check-version" role="function" condition="since:2.6">
<title>glib_check_version ()</title>
<indexterm zone="glib-check-version" role="2.6"><primary sortas="lib_check_version">glib_check_version</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link> *       glib_check_version                  (<link linkend="guint">guint</link> required_major,
                                                         <link linkend="guint">guint</link> required_minor,
                                                         <link linkend="guint">guint</link> required_micro);</programlisting>
<para>
Checks that the GLib library in use is compatible with the
given version. Generally you would pass in the constants
<link linkend="GLIB-MAJOR-VERSION--CAPS"><type>GLIB_MAJOR_VERSION</type></link>, <link linkend="GLIB-MINOR-VERSION--CAPS"><type>GLIB_MINOR_VERSION</type></link>, <link linkend="GLIB-MICRO-VERSION--CAPS"><type>GLIB_MICRO_VERSION</type></link>
as the three arguments to this function; that produces
a check that the library in use is compatible with
the version of GLib the application or module was compiled
against.
</para>
<para>
Compatibility is defined by two things: first the version
of the running library is newer than the version
<parameter>required_major.required_minor</parameter>.<parameter>required_micro</parameter>. Second
the running library must be binary compatible with the
version <parameter>required_major.required_minor</parameter>.<parameter>required_micro</parameter>
(same major version.)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>required_major</parameter>&#160;:</term>
<listitem><simpara> the required major version.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>required_minor</parameter>&#160;:</term>
<listitem><simpara> the required minor version.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>required_micro</parameter>&#160;:</term>
<listitem><simpara> the required micro version.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the GLib library is compatible with the
  given version, or a string describing the version mismatch.
  The returned string is owned by GLib and must not be modified
  or freed.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.6</para></refsect2>
<refsect2 id="GLIB-MAJOR-VERSION--CAPS" role="macro">
<title>GLIB_MAJOR_VERSION</title>
<indexterm zone="GLIB-MAJOR-VERSION--CAPS"><primary sortas="LIB_MAJOR_VERSION">GLIB_MAJOR_VERSION</primary></indexterm><programlisting>#define GLIB_MAJOR_VERSION 2
</programlisting>
<para>
The major version number of the GLib library.
Like <link linkend="glib-major-version"><type>glib_major_version</type></link>, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para></refsect2>
<refsect2 id="GLIB-MINOR-VERSION--CAPS" role="macro">
<title>GLIB_MINOR_VERSION</title>
<indexterm zone="GLIB-MINOR-VERSION--CAPS"><primary sortas="LIB_MINOR_VERSION">GLIB_MINOR_VERSION</primary></indexterm><programlisting>#define GLIB_MINOR_VERSION 21
</programlisting>
<para>
The minor version number of the GLib library.
Like <link linkend="gtk-minor-version"><type>gtk_minor_version</type></link>, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para></refsect2>
<refsect2 id="GLIB-MICRO-VERSION--CAPS" role="macro">
<title>GLIB_MICRO_VERSION</title>
<indexterm zone="GLIB-MICRO-VERSION--CAPS"><primary sortas="LIB_MICRO_VERSION">GLIB_MICRO_VERSION</primary></indexterm><programlisting>#define GLIB_MICRO_VERSION 4
</programlisting>
<para>
The micro version number of the GLib library.
Like <link linkend="gtk-micro-version"><type>gtk_micro_version</type></link>, but from the headers used at
application compile time, rather than from the library linked against
at application run time.
</para></refsect2>
<refsect2 id="GLIB-CHECK-VERSION--CAPS" role="macro">
<title>GLIB_CHECK_VERSION()</title>
<indexterm zone="GLIB-CHECK-VERSION--CAPS"><primary sortas="LIB_CHECK_VERSION">GLIB_CHECK_VERSION</primary></indexterm><programlisting>#define             GLIB_CHECK_VERSION(major,minor,micro)</programlisting>
<para>
Checks the version of the GLib library.
Returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the version of the GLib header files is the same
as or newer than the passed-in version.
<example>
<title>Checking the version of the GLib library</title>
<programlisting>
  if (!GLIB_CHECK_VERSION (1, 2, 0))
    g_error ("GLib version 1.2.0 or above is needed");
</programlisting>
</example>
</para><variablelist role="params">
<varlistentry><term><parameter>major</parameter>&#160;:</term>
<listitem><simpara>the major version number.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>minor</parameter>&#160;:</term>
<listitem><simpara>the minor version number.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>micro</parameter>&#160;:</term>
<listitem><simpara>the micro version number.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
