[Vala] Compile error (interfacing DBus)



Hi,

I've tried to deal with HAL's DBus-interface but got some compile errors (compiling the C code).

using GLib;

public class USBackup: Object
{

    public static int main(string[] args)
    {
        DBus.Connection     conn;
        dynamic DBus.Object manager;
        string[]            ids;

        conn =  DBus.Bus.get(DBus.BusType.SYSTEM);

        manager = conn.get_object("org.freedesktop.Hal",
                                  "/org/freedesktop/Hal/Manager",
                                  "org.freedesktop.Hal.Manager");

        ids = manager.GetAllDevices();

        [...]
        return 0;
    }
}

Fails to compile:
valac --pkg=dbus-glib-1 -o test src/main.vala
main.c: In function 'us_backup_main':
main.c:47: error: 'result' undeclared (first use in this function)
main.c:47: error: (Each undeclared identifier is reported only once
main.c:47: error: for each function it appears in.)
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)


I've also tried to define "ids" as Array<string> which fails with:
main.c: In function 'us_backup_main':
main.c:44: error: too few arguments to function 'g_array_free'
main.c:49: error: too few arguments to function 'g_array_free'
error: cc exited with status 256


I use vala 0.3.2 and gcc 4.2.3...
Any ideas???


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]