9
9
<refname>Version Information</refname>
10
10
<refpurpose>Variables and functions to check the GLib version</refpurpose>
11
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
14
<refsynopsisdiv role="synopsis">
13
<refsynopsisdiv id="glib-Version-Information.synopsis" role="synopsis">
15
14
<title role="synopsis.title">Synopsis</title>
19
18
#include <glib.h>
22
20
extern const guint <link linkend="glib-major-version">glib_major_version</link>;
23
21
extern const guint <link linkend="glib-minor-version">glib_minor_version</link>;
24
22
extern const guint <link linkend="glib-micro-version">glib_micro_version</link>;
25
23
extern const guint <link linkend="glib-binary-age">glib_binary_age</link>;
26
24
extern const guint <link linkend="glib-interface-age">glib_interface_age</link>;
27
const <link linkend="gchar">gchar</link>* <link linkend="glib-check-version">glib_check_version</link> (<link linkend="guint">guint</link> required_major,
25
const <link linkend="gchar">gchar</link> * <link linkend="glib-check-version">glib_check_version</link> (<link linkend="guint">guint</link> required_major,
28
26
<link linkend="guint">guint</link> required_minor,
29
27
<link linkend="guint">guint</link> required_micro);
31
#define <link linkend="GLIB-MAJOR-VERSION:CAPS">GLIB_MAJOR_VERSION</link>
32
#define <link linkend="GLIB-MINOR-VERSION:CAPS">GLIB_MINOR_VERSION</link>
33
#define <link linkend="GLIB-MICRO-VERSION:CAPS">GLIB_MICRO_VERSION</link>
34
#define <link linkend="GLIB-CHECK-VERSION:CAPS">GLIB_CHECK_VERSION</link> (major,minor,micro)
29
#define <link linkend="GLIB-MAJOR-VERSION--CAPS">GLIB_MAJOR_VERSION</link>
30
#define <link linkend="GLIB-MINOR-VERSION--CAPS">GLIB_MINOR_VERSION</link>
31
#define <link linkend="GLIB-MICRO-VERSION--CAPS">GLIB_MICRO_VERSION</link>
32
#define <link linkend="GLIB-CHECK-VERSION--CAPS">GLIB_CHECK_VERSION</link> (major,minor,micro)
55
<refsect1 role="details">
53
<refsect1 id="glib-Version-Information.details" role="details">
56
54
<title role="details.title">Details</title>
58
<title><anchor id="glib-major-version" role="variable"/>glib_major_version</title>
59
<indexterm><primary>glib_major_version</primary></indexterm><programlisting>extern const guint glib_major_version;
55
<refsect2 id="glib-major-version" role="variable">
56
<title>glib_major_version</title>
57
<indexterm zone="glib-major-version"><primary sortas="glib_major_version">glib_major_version</primary></indexterm><programlisting>extern const guint glib_major_version;
62
The major version number of the GLib library.
60
The major version number of the GLib library.
63
61
(e.g. in GLib version 1.2.5 this is 1.)
67
64
This variable is in the library, so represents the
68
65
GLib library you have linked against. Contrast with the
69
<link linkend="GLIB-MAJOR-VERSION:CAPS"><type>GLIB_MAJOR_VERSION</type></link> macro, which represents the major version of the
66
<link linkend="GLIB-MAJOR-VERSION--CAPS"><type>GLIB_MAJOR_VERSION</type></link> macro, which represents the major version of the
70
67
GLib headers you have included.
73
<title><anchor id="glib-minor-version" role="variable"/>glib_minor_version</title>
74
<indexterm><primary>glib_minor_version</primary></indexterm><programlisting>extern const guint glib_minor_version;
69
<refsect2 id="glib-minor-version" role="variable">
70
<title>glib_minor_version</title>
71
<indexterm zone="glib-minor-version"><primary sortas="glib_minor_version">glib_minor_version</primary></indexterm><programlisting>extern const guint glib_minor_version;
77
74
The minor version number of the GLib library.
78
75
(e.g. in GLib version 1.2.5 this is 2.)
82
78
This variable is in the library, so represents the
83
79
GLib library you have linked against. Contrast with the
84
<link linkend="GLIB-MINOR-VERSION:CAPS"><type>GLIB_MINOR_VERSION</type></link> macro, which represents the minor version of the
80
<link linkend="GLIB-MINOR-VERSION--CAPS"><type>GLIB_MINOR_VERSION</type></link> macro, which represents the minor version of the
85
81
GLib headers you have included.
88
<title><anchor id="glib-micro-version" role="variable"/>glib_micro_version</title>
89
<indexterm><primary>glib_micro_version</primary></indexterm><programlisting>extern const guint glib_micro_version;
83
<refsect2 id="glib-micro-version" role="variable">
84
<title>glib_micro_version</title>
85
<indexterm zone="glib-micro-version"><primary sortas="glib_micro_version">glib_micro_version</primary></indexterm><programlisting>extern const guint glib_micro_version;
92
88
The micro version number of the GLib library.
93
89
(e.g. in GLib version 1.2.5 this is 5.)
97
92
This variable is in the library, so represents the GLib library you
98
have linked against. Contrast with the <link linkend="GLIB-MICRO-VERSION:CAPS"><type>GLIB_MICRO_VERSION</type></link> macro, which
93
have linked against. Contrast with the <link linkend="GLIB-MICRO-VERSION--CAPS"><type>GLIB_MICRO_VERSION</type></link> macro, which
99
94
represents the micro version of the GLib headers you have included.
100
95
</para></refsect2>
102
<title><anchor id="glib-binary-age" role="variable"/>glib_binary_age</title>
103
<indexterm><primary>glib_binary_age</primary></indexterm><programlisting>extern const guint glib_binary_age;
106
This is the binary age passed to <application>libtool</application>. If
107
<application>libtool</application> means nothing to you, don't worry
111
<title><anchor id="glib-interface-age" role="variable"/>glib_interface_age</title>
112
<indexterm><primary>glib_interface_age</primary></indexterm><programlisting>extern const guint glib_interface_age;
115
This is the interface age passed to <application>libtool</application>. If
116
<application>libtool</application> means nothing to you, don't worry
120
<title><anchor id="glib-check-version" role="function" condition="since:2.6"/>glib_check_version ()</title>
121
<indexterm role="2.6"><primary>glib_check_version</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* glib_check_version (<link linkend="guint">guint</link> required_major,
96
<refsect2 id="glib-binary-age" role="variable">
97
<title>glib_binary_age</title>
98
<indexterm zone="glib-binary-age"><primary sortas="glib_binary_age">glib_binary_age</primary></indexterm><programlisting>extern const guint glib_binary_age;
101
This is the binary age passed to <application>libtool</application>. If
102
<application>libtool</application> means nothing to you, don't worry
105
<refsect2 id="glib-interface-age" role="variable">
106
<title>glib_interface_age</title>
107
<indexterm zone="glib-interface-age"><primary sortas="glib_interface_age">glib_interface_age</primary></indexterm><programlisting>extern const guint glib_interface_age;
110
This is the interface age passed to <application>libtool</application>. If
111
<application>libtool</application> means nothing to you, don't worry
114
<refsect2 id="glib-check-version" role="function" condition="since:2.6">
115
<title>glib_check_version ()</title>
116
<indexterm zone="glib-check-version" role="2.6"><primary sortas="glib_check_version">glib_check_version</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link> * glib_check_version (<link linkend="guint">guint</link> required_major,
122
117
<link linkend="guint">guint</link> required_minor,
123
118
<link linkend="guint">guint</link> required_micro);</programlisting>
125
120
Checks that the GLib library in use is compatible with the
126
121
given version. Generally you would pass in the constants
127
<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>
122
<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>
128
123
as the three arguments to this function; that produces
129
124
a check that the library in use is compatible with
130
125
the version of GLib the application or module was compiled
138
133
version <parameter>required_major.required_minor</parameter>.<parameter>required_micro</parameter>
139
134
(same major version.)</para>
142
136
</para><variablelist role="params">
143
<varlistentry><term><parameter>required_major</parameter> :</term>
137
<varlistentry><term><parameter>required_major</parameter> :</term>
144
138
<listitem><simpara> the required major version.
145
139
</simpara></listitem></varlistentry>
146
<varlistentry><term><parameter>required_minor</parameter> :</term>
140
<varlistentry><term><parameter>required_minor</parameter> :</term>
147
141
<listitem><simpara> the required minor version.
148
142
</simpara></listitem></varlistentry>
149
<varlistentry><term><parameter>required_micro</parameter> :</term>
143
<varlistentry><term><parameter>required_micro</parameter> :</term>
150
144
<listitem><simpara> the required micro version.
151
145
</simpara></listitem></varlistentry>
152
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <link linkend="NULL:CAPS"><literal>NULL</literal></link> if the GLib library is compatible with the
146
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <link linkend="NULL--CAPS"><literal>NULL</literal></link> if the GLib library is compatible with the
153
147
given version, or a string describing the version mismatch.
154
148
The returned string is owned by GLib and must not be modified
157
151
</simpara></listitem></varlistentry>
158
</variablelist><para role="since">Since 2.6
161
<title><anchor id="GLIB-MAJOR-VERSION:CAPS" role="macro"/>GLIB_MAJOR_VERSION</title>
162
<indexterm><primary>GLIB_MAJOR_VERSION</primary></indexterm><programlisting>#define GLIB_MAJOR_VERSION 2
152
</variablelist><para role="since">Since 2.6</para></refsect2>
153
<refsect2 id="GLIB-MAJOR-VERSION--CAPS" role="macro">
154
<title>GLIB_MAJOR_VERSION</title>
155
<indexterm zone="GLIB-MAJOR-VERSION--CAPS"><primary sortas="GLIB_MAJOR_VERSION">GLIB_MAJOR_VERSION</primary></indexterm><programlisting>#define GLIB_MAJOR_VERSION 2
163
156
</programlisting>
165
158
The major version number of the GLib library.
187
180
application compile time, rather than from the library linked against
188
181
at application run time.
189
182
</para></refsect2>
191
<title><anchor id="GLIB-CHECK-VERSION:CAPS" role="macro"/>GLIB_CHECK_VERSION()</title>
192
<indexterm><primary>GLIB_CHECK_VERSION</primary></indexterm><programlisting>#define GLIB_CHECK_VERSION(major,minor,micro)</programlisting>
183
<refsect2 id="GLIB-CHECK-VERSION--CAPS" role="macro">
184
<title>GLIB_CHECK_VERSION()</title>
185
<indexterm zone="GLIB-CHECK-VERSION--CAPS"><primary sortas="GLIB_CHECK_VERSION">GLIB_CHECK_VERSION</primary></indexterm><programlisting>#define GLIB_CHECK_VERSION(major,minor,micro)</programlisting>
194
187
Checks the version of the GLib library.
195
Returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the version of the GLib header files is the same
188
Returns <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the version of the GLib header files is the same
196
189
as or newer than the passed-in version.
199
191
<title>Checking the version of the GLib library</title>