Hi,

2011/5/17 Abderrahim KITOUNI <[email protected]>:
> > I'm writing a new library in vala, and that library uses our old library 
> > which is written in c. Until now I was able to write VAPI files for 
> > everything in the old library, but now I stumbled on a big problem - some 
> > functions in the old library returns GLib.List with some dynamicaly 
> > allocated structs ("Compact class in vala terminology) as data members. 
> > Something like this:
> >
> > [...]
> >
> > But now I'm trying to use the result of "old_lib_make_x_list" in vala and 
> > there it all fails.
> >
> > The VAPI file looks something like this:
> > [...]
> >
> > Now I have probably two, equaly wrong possibilities. Either let vala manage 
> > things (it can't of course..):
> 
> Another possibility is to let vala actually manage things ;-)
> 
> Did you have any problem with the following? it should be the first
> thing you try (and is likely the correct thing):
> 
> [CCode (cheader_filename = "oldlib.h")]
> public static GLib.List<X> old_lib_make_x_list();

Thanks for your reply, but unfortunately, it really WAS the first thing I did
- but because X is not reference counted, it resulted in errors like this:

oldlib.vapi:61.33-61.36: error: duplicating X instance, use unowned variable or 
explicitly invoke copy method
        public static GLib.List<X> old_lib_make_x_list();
                                ^

And I don't really want to copy the "X" structure, because it's rather large
and there are a lot of them..

Maybe I don't see something obvious, I'm still not fully comfortable in vala
and I may have missed something..

But anyway, thanks.

Regards,
Jan Spurny

_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to