![]() |
![]() |
![]() |
GLib参考手册 | ![]() |
---|---|---|---|---|
Top | Description |
#include <glib.h> extern const guint glib_major_version; extern const guint glib_minor_version; extern const guint glib_micro_version; extern const guint glib_binary_age; extern const guint glib_interface_age; const gchar * glib_check_version (guint required_major
,guint required_minor
,guint required_micro
); #define GLIB_MAJOR_VERSION #define GLIB_MINOR_VERSION #define GLIB_MICRO_VERSION #define GLIB_CHECK_VERSION (major, minor, micro)
const gchar * glib_check_version (guint required_major
,guint required_minor
,guint required_micro
);
检查当前使用的GLib库的版本和指定的版本是否兼容。通常把GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION这三个宏作为传入参数,用来检查当前编 译的应用程序或者模块和链接的GLib库是否兼容。
Compatibility is defined by two things: first the version
of the running library is newer than the version
required_major.required_minor
.required_micro
. Second
the running library must be binary compatible with the
version required_major.required_minor
.required_micro
(same major version.)
|
要求的主版本号 |
|
要求的次版本号 |
|
要求的小版本号 |
Returns : |
如果版本可以兼容,返回NULL 。如果版本不兼容,返回一个版本不匹配
的字符串。返回的是GLib的字符串,应用程序不要去修改或者释放。 |
Since 2.6
#define GLIB_MAJOR_VERSION 2
GLib头文件的主版本号。来自于应用程序编译时使用的头文件的主版本号,而不是来自链接的库文件的主版本号。
#define GLIB_MINOR_VERSION 26
GLib头文件的次版本号。来自于应用程序编译时使用的头文件的次版本号,而不是来自链接的库文件的次版本号。
#define GLIB_MICRO_VERSION 1
GLib头文件的小版本号。来自于应用程序编译时使用的头文件的小版本号,而不是来自链接的库文件的小版本号。
#define GLIB_CHECK_VERSION(major,minor,micro)
检查GLib的版本。
如果引用的GLib头文件的版本与传入的版本号相同,或者比传入的版本号更新,则返回TRUE
。
Example 1. 检查GLib的版本号
if (!GLIB_CHECK_VERSION (1, 2, 0)) g_error ("GLib version 1.2.0 or above is needed");
|
主版本号。 |
|
次版本号。 |
|
小版本号。 |