gnome.gio
importGIO 2.82.5 — files, streams, sockets, D-Bus, GSettings and GListModel
import gnome.gio;
#include <gio/gio.h>
模块名取自本索引给这个包写的测试项目。
mcpp add gnome.gio@2.82.5
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// ⭐ THE MODULE, WHICH IS WHAT THE NAMESPACE PROMISES.
//
// In this index the namespace is the contract: `compat.xxx` is consumed with
// `#include`, an owner namespace like `gnome.xxx` exposes `import`. The test
// next to this file consumes gnome.gio through its headers; this one consumes
// the same package through its module, so both doors are checked from the
// OUTSIDE — which is what an index example is for.
//
// ⚠️ THE TWO DOORS DO NOT COMPOSE, and that is GCC's rule rather than a choice
// here. A TU that imports the module AND textually includes a glib header
// reaches <time.h> twice — once through the module's global fragment, once
// directly — and the same `struct tm` from the same file becomes two entities:
//
// error: conflicting declaration 'struct tm'
// note: previous declaration as 'struct tm' (of module gnome.glib)
//
// So a consumer picks ONE route, and which one is decided by macros: a module
// cannot carry them, and glib's are half its API. Code using `G_DEFINE_TYPE`,
// `G_OBJECT` or `G_TYPE_*` takes the header route. Code using the FUNCTION API
// — most of gio, and much of glib — imports and includes nothing.
#ifdef __linux__
// …
tests/examples/gio/tests/module.cpp · 项目 tests/examples/gio
构建 · 上游清单
- targets
gio-2_0 (lib), gio (lib)- language
c++23- manifest version
2.82.5- dependencies
gnome, compat- 来源
https://raw.githubusercontent.com/mcpplibs/glib/2.82.5/mcpp/gio/mcpp.toml