<?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 pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="gtk4-Feature-Test-Macros">
<refmeta>
<refentrytitle role="top_of_page" id="gtk4-Feature-Test-Macros.top_of_page">Version Information</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Version Information</refname>
<refpurpose>Variables and functions to check the GTK version</refpurpose>
</refnamediv>

<refsect1 id="gtk4-Feature-Test-Macros.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-get-major-version">gtk_get_major_version</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-get-minor-version">gtk_get_minor_version</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-get-micro-version">gtk_get_micro_version</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-get-binary-age">gtk_get_binary_age</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-get-interface-age">gtk_get_interface_age</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-check-version">gtk_check_version</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-CHECK-VERSION:CAPS">GTK_CHECK_VERSION</link><phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gtk4-Feature-Test-Macros.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-MAJOR-VERSION:CAPS">GTK_MAJOR_VERSION</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-MINOR-VERSION:CAPS">GTK_MINOR_VERSION</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-MICRO-VERSION:CAPS">GTK_MICRO_VERSION</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-BINARY-AGE:CAPS">GTK_BINARY_AGE</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-INTERFACE-AGE:CAPS">GTK_INTERFACE_AGE</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="gtk4-Feature-Test-Macros.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="gtk4-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="gtk4-Feature-Test-Macros.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-get-major-version" role="function">
<title>gtk_get_major_version&#160;()</title>
<indexterm zone="gtk-get-major-version"><primary>gtk_get_major_version</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_get_major_version (<parameter><type>void</type></parameter>);</programlisting>
<para>Returns the major version number of the GTK library.
(e.g. in GTK version 3.1.5 this is 3.)</para>
<para>This function is in the library, so it represents the GTK library
your code is running 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 when compiling your code.</para>
<refsect3 id="gtk-get-major-version.returns" role="returns">
<title>Returns</title>
<para> the major version number of the GTK library</para>
</refsect3></refsect2>
<refsect2 id="gtk-get-minor-version" role="function">
<title>gtk_get_minor_version&#160;()</title>
<indexterm zone="gtk-get-minor-version"><primary>gtk_get_minor_version</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_get_minor_version (<parameter><type>void</type></parameter>);</programlisting>
<para>Returns the minor version number of the GTK library.
(e.g. in GTK version 3.1.5 this is 1.)</para>
<para>This function is in the library, so it represents the GTK library
your code is are running 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 when compiling your code.</para>
<refsect3 id="gtk-get-minor-version.returns" role="returns">
<title>Returns</title>
<para> the minor version number of the GTK library</para>
</refsect3></refsect2>
<refsect2 id="gtk-get-micro-version" role="function">
<title>gtk_get_micro_version&#160;()</title>
<indexterm zone="gtk-get-micro-version"><primary>gtk_get_micro_version</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_get_micro_version (<parameter><type>void</type></parameter>);</programlisting>
<para>Returns the micro version number of the GTK library.
(e.g. in GTK version 3.1.5 this is 5.)</para>
<para>This function is in the library, so it represents the GTK library
your code is are running 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 when compiling your code.</para>
<refsect3 id="gtk-get-micro-version.returns" role="returns">
<title>Returns</title>
<para> the micro version number of the GTK library</para>
</refsect3></refsect2>
<refsect2 id="gtk-get-binary-age" role="function">
<title>gtk_get_binary_age&#160;()</title>
<indexterm zone="gtk-get-binary-age"><primary>gtk_get_binary_age</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_get_binary_age (<parameter><type>void</type></parameter>);</programlisting>
<para>Returns the binary age as passed to <literal>libtool</literal>
when building the GTK library the process is running against.
If <literal>libtool</literal> means nothing to you, don't
worry about it.</para>
<refsect3 id="gtk-get-binary-age.returns" role="returns">
<title>Returns</title>
<para> the binary age of the GTK library</para>
</refsect3></refsect2>
<refsect2 id="gtk-get-interface-age" role="function">
<title>gtk_get_interface_age&#160;()</title>
<indexterm zone="gtk-get-interface-age"><primary>gtk_get_interface_age</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
gtk_get_interface_age (<parameter><type>void</type></parameter>);</programlisting>
<para>Returns the interface age as passed to <literal>libtool</literal>
when building the GTK library the process is running against.
If <literal>libtool</literal> means nothing to you, don't
worry about it.</para>
<refsect3 id="gtk-get-interface-age.returns" role="returns">
<title>Returns</title>
<para> the interface age of the GTK library</para>
</refsect3></refsect2>
<refsect2 id="gtk-check-version" role="function">
<title>gtk_check_version&#160;()</title>
<indexterm zone="gtk-check-version"><primary>gtk_check_version</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gtk_check_version (<parameter><link linkend="guint"><type>guint</type></link> required_major</parameter>,
                   <parameter><link linkend="guint"><type>guint</type></link> required_minor</parameter>,
                   <parameter><link linkend="guint"><type>guint</type></link> required_micro</parameter>);</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
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>
<refsect3 id="gtk-check-version.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>required_major</para></entry>
<entry role="parameter_description"><para>the required major version</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>required_minor</para></entry>
<entry role="parameter_description"><para>the required minor version</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>required_micro</para></entry>
<entry role="parameter_description"><para>the required micro version</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-check-version.returns" role="returns">
<title>Returns</title>
<para><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. </para>
<para><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="GTK-CHECK-VERSION:CAPS" role="macro">
<title>GTK_CHECK_VERSION()</title>
<indexterm zone="GTK-CHECK-VERSION:CAPS"><primary>GTK_CHECK_VERSION</primary></indexterm>
<programlisting language="C">#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>
<refsect3 id="GTK-CHECK-VERSION.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>major</para></entry>
<entry role="parameter_description"><para>major version (e.g. 1 for version 1.2.5)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>minor</para></entry>
<entry role="parameter_description"><para>minor version (e.g. 2 for version 1.2.5)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>micro</para></entry>
<entry role="parameter_description"><para>micro version (e.g. 5 for version 1.2.5)</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GTK-CHECK-VERSION.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if GTK+ headers are new enough</para>
</refsect3></refsect2>

</refsect1>
<refsect1 id="gtk4-Feature-Test-Macros.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GTK-MAJOR-VERSION:CAPS" role="macro">
<title>GTK_MAJOR_VERSION</title>
<indexterm zone="GTK-MAJOR-VERSION:CAPS"><primary>GTK_MAJOR_VERSION</primary></indexterm>
<programlisting language="C">#define GTK_MAJOR_VERSION (3)
</programlisting>
<para>Like <link linkend="gtk-get-major-version"><function>gtk_get_major_version()</function></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>GTK_MINOR_VERSION</primary></indexterm>
<programlisting language="C">#define GTK_MINOR_VERSION (98)
</programlisting>
<para>Like <link linkend="gtk-get-minor-version"><function>gtk_get_minor_version()</function></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>GTK_MICRO_VERSION</primary></indexterm>
<programlisting language="C">#define GTK_MICRO_VERSION (4)
</programlisting>
<para>Like <link linkend="gtk-get-micro-version"><function>gtk_get_micro_version()</function></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>GTK_BINARY_AGE</primary></indexterm>
<programlisting language="C">#define GTK_BINARY_AGE    (9804)
</programlisting>
<para>Like <link linkend="gtk-get-binary-age"><function>gtk_get_binary_age()</function></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>GTK_INTERFACE_AGE</primary></indexterm>
<programlisting language="C">#define GTK_INTERFACE_AGE (0)
</programlisting>
<para>Like <link linkend="gtk-get-interface-age"><function>gtk_get_interface_age()</function></link>, but from the headers used at
application compile time, rather than from the library linked
against at application run time.</para>
</refsect2>

</refsect1>

</refentry>
