【发布时间】:2017-08-16 13:43:35
【问题描述】:
我正在实现一个 dbus 服务器,为了简化操作,我决定使用gdbus-codegen。
This hello world example 和 it's repository 将生成头文件和源文件。然后它将信号连接到函数:
g_signal_connect (interface,
"handle-hello-world",
G_CALLBACK (on_handle_hello_world), NULL);
接下来是我的问题:
- 函数
GType min_min_bus_gdbus_get_type (void)应该做什么?它已声明,但未在生成的文件中定义。 - 我可以使用在生成的标头中声明的
struct MinMinBusGDBUSIface,而不是将信号连接到回调函数(如上所述)吗?
我在网上找到的任何示例都有这两个东西(*_get_type (void) 函数声明和struct *Iface 在生成的标头中声明。如何使用它们?
【问题讨论】:
-
是的,C 是与 C++ 不同的语言。您想要 C 或 C++ 的答案吗?
-
@Toby 我知道它们是不同的,但 C 和 C++ 的答案应该是相同的。