Re: [GI] Get info about return value



Thank you very much for your reply; I see it more clear now. Please find my comments inlined.

On 01 Dec 2013, at 20:46, Colin Walters <walters verbum org> wrote:

Hi,

On Sun, 2013-12-01 at 19:43 +0100, Juan Rafael García Blanco wrote:

I’m trying to generate automatic bindings for gobject-introspected libraries for a compiled language. 

Compiled as in C/C++, so you want e.g. "GtkWidget *" for arguments of
type Gtk.Widget?  Reversing g-ir-scanner is easy for the basic cases,
but gets nontrivial with stuff like inout arrays.

Exactly, compiled as in C/C++. I’ve not reached the point in where I need to handle arrays.


Now I’m the need of generating method signatures, but I couldn’t find a way to get a string representation
for return and argument types. 

You'll have to clarify exactly what you want to do with a string
representation.

Sorry, I used a confusing expression. By string representation I meant exactly what you mentioned above: 
"GtkWidget *" for Gtk.Widget (pointer). I meant a string representation from the point of view of the 
language I’m trying to generate bindings for; that is, actual code in the target language.


Once I get the corresponding GITypeInfo I don’t know how to proceed.
I would like to get a pointer to the GIObjectInfo, GIEnumInfo,

Call g_base_info_get_interface() to get the target type, then
g_base_info_get_type() will tell you whether it's e.g. a
GI_INFO_TYPE_ENUM, a GI_INFO_TYPE_OBJECT, etc.

After I read this I tried something and I think that I misunderstood what get_interface means. I thought that 
interface stood for actual gobject interfaces; but now I see that it’s also applicable to standard classes. 
And the GType tag refers to exactly that, GType.


The gjs and pygobject git repositories should be useful references.



Yes, I’m aware of these GI users; but here I’m in doubt: since I’m trying to generate ‘static’ bindings (i.e. 
for a compiled language), is girepository (i.e. the gobject-introspection library that interacts with 
typelibs) suitable for my needs? Or should I rather use GIR files directly and build my own parser?

I’ve been told that using the gobject-introspection library and therefore typelib files could make my 
bindings platform dependent. I’m not sure of this; I think that I can easily overcome the platform dependent 
parts of typlibs. So this is the question that I’m a little bit afraid of doing myself: is it right to use 
the gobject-introspction library to generate bindings for a compiled language?

Thank you very much.

Regards,
Juan.


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