<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<!--ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml"-->
<refentry id="gtk-Feature-Test-Macros">
<refmeta>
<refentrytitle role="top_of_page" id="gtk-Feature-Test-Macros.top_of_page">Version Information</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

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

<refsynopsisdiv id="gtk-Feature-Test-Macros.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gtk/gtk.h&gt;

extern              const guint <link linkend="gtk-major-version">gtk_major_version</link>;
extern              const guint <link linkend="gtk-minor-version">gtk_minor_version</link>;
extern              const guint <link linkend="gtk-micro-version">gtk_micro_version</link>;
extern              const guint <link linkend="gtk-binary-age">gtk_binary_age</link>;
extern              const guint <link linkend="gtk-interface-age">gtk_interface_age</link>;
const <link linkend="gchar">gchar</link>*        <link linkend="gtk-check-version">gtk_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="GTK-MAJOR-VERSION--CAPS">GTK_MAJOR_VERSION</link>
#define             <link linkend="GTK-MINOR-VERSION--CAPS">GTK_MINOR_VERSION</link>
#define             <link linkend="GTK-MICRO-VERSION--CAPS">GTK_MICRO_VERSION</link>
#define             <link linkend="GTK-BINARY-AGE--CAPS">GTK_BINARY_AGE</link>
#define             <link linkend="GTK-INTERFACE-AGE--CAPS">GTK_INTERFACE_AGE</link>
#define             <link linkend="GTK-CHECK-VERSION--CAPS">GTK_CHECK_VERSION</link>                   (major,minor,micro)
</synopsis>
</refsynopsisdiv>









<refsect1 id="gtk-Feature-Test-Macros.description" role="desc">
<title role="desc.title">Description</title>
<para>
GTK+ 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="gtk-Feature-Test-Macros.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="gtk-major-version" role="variable">
<title>gtk_major_version</title>
<indexterm zone="gtk-major-version"><primary sortas="major_version">gtk_major_version</primary></indexterm><programlisting>extern const guint gtk_major_version;
</programlisting>
<para>
The major version number of the GTK+ library.  (e.g. in GTK+ version
1.2.5 this is 1.)
</para>
<para>
This variable is in the library, so represents the
GTK+ library you have linked against. Contrast with the
<link linkend="GTK-MAJOR-VERSION--CAPS"><type>GTK_MAJOR_VERSION</type></link> macro, which represents the major version of the
GTK+ headers you have included.
</para></refsect2>
<refsect2 id="gtk-minor-version" role="variable">
<title>gtk_minor_version</title>
<indexterm zone="gtk-minor-version"><primary sortas="minor_version">gtk_minor_version</primary></indexterm><programlisting>extern const guint gtk_minor_version;
</programlisting>
<para>
The minor version number of the GTK+ library.
(e.g. in GTK+ version 1.2.5 this is 2.)
</para>
<para>
This variable is in the library, so represents the
GTK+ library you have linked against. Contrast with the
<link linkend="GTK-MINOR-VERSION--CAPS"><type>GTK_MINOR_VERSION</type></link> macro, which represents the minor version of the
GTK+ headers you have included.
</para></refsect2>
<refsect2 id="gtk-micro-version" role="variable">
<title>gtk_micro_version</title>
<indexterm zone="gtk-micro-version"><primary sortas="micro_version">gtk_micro_version</primary></indexterm><programlisting>extern const guint gtk_micro_version;
</programlisting>
<para>
The micro version number of the GTK+ library.
(e.g. in GTK+ version 1.2.5 this is 5.)
</para>
<para>
This variable is in the library, so represents the GTK+ library you
have linked against. Contrast with the <link linkend="GTK-MICRO-VERSION--CAPS"><type>GTK_MICRO_VERSION</type></link> macro, which
represents the micro version of the GTK+ headers you have included.
</para></refsect2>
<refsect2 id="gtk-binary-age" role="variable">
<title>gtk_binary_age</title>
<indexterm zone="gtk-binary-age"><primary sortas="binary_age">gtk_binary_age</primary></indexterm><programlisting>extern const guint gtk_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="gtk-interface-age" role="variable">
<title>gtk_interface_age</title>
<indexterm zone="gtk-interface-age"><primary sortas="interface_age">gtk_interface_age</primary></indexterm><programlisting>extern const guint gtk_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="gtk-check-version" role="function">
<title>gtk_check_version ()</title>
<indexterm zone="gtk-check-version"><primary sortas="check_version">gtk_check_version</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>*        gtk_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 GTK+ library in use is compatible with the
given version. Generally you would pass in the constants
<link linkend="GTK-MAJOR-VERSION--CAPS"><type>GTK_MAJOR_VERSION</type></link>, <link linkend="GTK-MINOR-VERSION--CAPS"><type>GTK_MINOR_VERSION</type></link>, <link linkend="GTK-MICRO-VERSION--CAPS"><type>GTK_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 GTK+ 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>
This function is primarily for GTK+ modules; the module
can call this function to check that it wasn't loaded
into an incompatible version of GTK+. However, such a
a check isn't completely reliable, since the module may be
linked against an old version of GTK+ and calling the
old version of <link linkend="gtk-check-version"><function>gtk_check_version()</function></link>, but still get loaded
into an application using a newer version of GTK+.</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 GTK+ library is compatible with the
  given version, or a string describing the version mismatch.
  The returned string is owned by GTK+ and should not be modified
  or freed.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GTK-MAJOR-VERSION--CAPS" role="macro">
<title>GTK_MAJOR_VERSION</title>
<indexterm zone="GTK-MAJOR-VERSION--CAPS"><primary sortas="MAJOR_VERSION">GTK_MAJOR_VERSION</primary></indexterm><programlisting>#define GTK_MAJOR_VERSION				(2)
</programlisting>
<para>
Like <link linkend="gtk-major-version"><type>gtk_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="GTK-MINOR-VERSION--CAPS" role="macro">
<title>GTK_MINOR_VERSION</title>
<indexterm zone="GTK-MINOR-VERSION--CAPS"><primary sortas="MINOR_VERSION">GTK_MINOR_VERSION</primary></indexterm><programlisting>#define GTK_MINOR_VERSION				(17)
</programlisting>
<para>
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="GTK-MICRO-VERSION--CAPS" role="macro">
<title>GTK_MICRO_VERSION</title>
<indexterm zone="GTK-MICRO-VERSION--CAPS"><primary sortas="MICRO_VERSION">GTK_MICRO_VERSION</primary></indexterm><programlisting>#define GTK_MICRO_VERSION				(7)
</programlisting>
<para>
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="GTK-BINARY-AGE--CAPS" role="macro">
<title>GTK_BINARY_AGE</title>
<indexterm zone="GTK-BINARY-AGE--CAPS"><primary sortas="BINARY_AGE">GTK_BINARY_AGE</primary></indexterm><programlisting>#define GTK_BINARY_AGE					(1707)
</programlisting>
<para>
Like <link linkend="gtk-binary-age"><type>gtk_binary_age</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="GTK-INTERFACE-AGE--CAPS" role="macro">
<title>GTK_INTERFACE_AGE</title>
<indexterm zone="GTK-INTERFACE-AGE--CAPS"><primary sortas="INTERFACE_AGE">GTK_INTERFACE_AGE</primary></indexterm><programlisting>#define GTK_INTERFACE_AGE				(0)
</programlisting>
<para>
Like <link linkend="gtk-interface-age"><type>gtk_interface_age</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="GTK-CHECK-VERSION--CAPS" role="macro">
<title>GTK_CHECK_VERSION()</title>
<indexterm zone="GTK-CHECK-VERSION--CAPS"><primary sortas="CHECK_VERSION">GTK_CHECK_VERSION</primary></indexterm><programlisting>#define             GTK_CHECK_VERSION(major,minor,micro)</programlisting>
<para>
Returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the version of the GTK+ header files is the same
as or newer than the passed-in version.
</para><variablelist role="params">
<varlistentry><term><parameter>major</parameter>&#160;:</term>
<listitem><simpara>major version (e.g. 1 for version 1.2.5)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>minor</parameter>&#160;:</term>
<listitem><simpara>minor version (e.g. 2 for version 1.2.5)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>micro</parameter>&#160;:</term>
<listitem><simpara>micro version (e.g. 5 for version 1.2.5)
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>




</refentry>
