【问题标题】:valac generating bad C code on DBus programvalac 在 DBus 程序上生成错误的 C 代码
【发布时间】:2013-05-17 11:03:19
【问题描述】:

有人能发现这段代码的问题吗? 它正在使用 valac 进行编译,但是当 gcc 尝试编译由 valac 生成的 C 代码时出现错误,这是 gcc 的输出:

(...) Weather.c: En la función ‘__lambda3_’:
(...) Weather.c:696:9: aviso: la asignación descarta el calificador ‘const’ del tipo del destino del puntero [activado por defecto]
(...) Weather.c: En la función ‘address_proxy_get_address’:
(...) Weather.c:1535:228: error: ‘error’ no se declaró aquí (primer uso en esta función)
(...) Weather.c:1535:228: nota: cada identificador sin declarar se reporta sólo una vez para cada función en el que aparece

DBus 接口声明如下:

[DBus (name="org.freedesktop.Geoclue.Address")]
interface Address : Object {
    public abstract void get_address (out int32 timestamp, out HashTable<string,string> address, out Accuracy acc);
    public signal void address_changed (int32 timestamp, HashTable<string,string> address, Accuracy acc);
}

struct Accuracy {
    int32 int1;
    double double1;
    double double2;
}

【问题讨论】:

  • 函数address_proxy_get_address 声明在哪里?它抱怨的是那个功能,而不是你展示的东西。

标签: dbus vala


【解决方案1】:

D-Bus 代理的方法需要抛出异常:

public abstract void get_address (out int32 timestamp, out HashTable<string,string> address, out Accuracy acc) throws GLib.IOError;

【讨论】:

    猜你喜欢
    • 2010-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-28
    • 1970-01-01
    • 2017-12-19
    • 1970-01-01
    相关资源
    最近更新 更多