[Vala] Posix.lstat problems



I've got this piece of code:

using Posix;

        int fuseguifs_getattr(string path, Posix.Stat *stbuf)
        {
                int res;
                res = Posix.lstat(path, stbuf);
                if (res == -1)
                        return -Posix.errno;
        
                return 0;
        }
        
        static int main(string [] args)
        {
                Posix.Stat *a;
                fuseguifs_getattr("/home/leon", a);
                return 0;
        }
        
When I'm trying to compile it I get this error:
        test.vala:6.26-6.30: error: Argument 2: Cannot convert from
        `Posix.Stat' to `Posix.Stat*'
                res = Posix.lstat(path, stbuf);
                                        ^^^^^
        Compilation failed: 1 error(s), 0 warning(s)
        
I've tried changing this:
        fuseguifs_getattr("/home/leon", a);
to
        fuseguifs_getattr("/home/leon", *a);
        
But then I get an error: "Cannot pass value to reference or output
parameter"

I've tried adding "out":
        res = Posix.lstat(path, out *stbuf);

That gives this error:
error: ref and out method arguments can only be used with fields,
parameters, local variables, and array element access

I can't change the fuseguifs_getattr method parameters because that's
part of how the fuse bindings expect it.

I'm really stuck. Does anyone how I can solve this?

Leon



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