[Vala] How to own a void *
- From: Jan Hudec <bulb ucw cz>
- To: vala-list gnome org
- Subject: [Vala] How to own a void *
- Date: Tue, 1 Sep 2009 18:23:43 +0200
Hello,
I have a big problem. I am getting some object in a "void *". The object is
owned, but it can be of any type, so I can't write the type to the .vapi. The
caller knows what type it will be, but I don't know how to make vala release
it. Moreover it's a noncopyable type, so I need to make vala transfer the
ownership. How can I do that?
In particular I have:
struct Argument {
void * pointer;
// some other members, too -- and it's actually a union in C
}
and than
Argument retval;
something.invoke(ref retval);
// now from nature of something I know Argument points to GValueArray and
// that it must be freed, so
ValueArray values = /*something*/retval.pointer;
Now what the /*something*/ should be? Remember, the object must be release by
me and it cannot be copied, so I need to transfer ownership.
Calling free later is not easy either -- the values variable is actually
member and will be needed a lot later.
--
Jan 'Bulb' Hudec <bulb ucw cz>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]