Creating an introspectable API

Hi, I need some advise related to creating an API.

Would you recommend for GObject-Introspection, structs or boxed types on structs?

I have some code and I really love recent changes :slight_smile:

http://savannah.nongnu.org/forum/forum.php?forum_id=9728

Here is an example using structs:

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/audio/fx/ags_fx_dssi_audio.h?h=3.3.x

Basically I do:

typedef struct _AgsFxDssiAudioScopeData AgsFxDssiAudioScopeData;

Would you make this boxed?

https://developer.gnome.org/gobject/stable/gobject-Boxed-Types.html

1 Like

On IRC we talked about if you need a type, you need to create a boxed struct. Else it would be just a black-box.

For reference, there is also https://developer.gnome.org/programming-guidelines/stable/introspection.html.en#api-design and the links in that section, https://wiki.gnome.org/Projects/GObjectIntrospection/WritingBindingableAPIs in particular

1 Like

I was mainly using this for reference:

https://gi.readthedocs.io/en/latest/annotations/giannotations.html

thank you!

Hi, a black-box is next to ANSI C structs …

I decided to use the type signature:

https://gi.readthedocs.io/en/latest/annotations/giannotations.html#type-signature

As done here:

http://git.savannah.nongnu.org/cgit/gsequencer.git/tree/ags/audio/fx/ags_fx_analyse_channel.h?h=3.3.x

This because it contains a GRecMutex and other fields it shall not copy.

best regards,
Joël

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.