How exactly do I use GObject introspection to generate bindings?

I need to access the GLib library in the spice-gtk project in a Java program. I found I can generate Java binding with GObject Introspection. It isn’t clear to me how to use it though. Can I generate the Java bindings with one of the command line tools? How am I supposed to do it? There is a prebuilt typelib library for Ubuntu, so that is covered, but how do I generate those bindings?

I also noticed there was a tool called JGIR, but it’s really old. The repo for it is archived and the last commit was 15 years ago. I would like something a little more up to date :slight_smile:

There is a new one, but it’s still in development:

Thank you. This looks great!

One more thing: Is there a modern tool for generating Java bindings that still uses JNI? It’s okay if there isn’t, but it would allow more people to use the plugin I’m working on. Or should I just use JGIR for that? I don’t think JNI has changed, but I’m worrying since GLib has changed that maybe it would mess it up

I suppose I will have to resort to using SWIG to generate a library that uses JNI. In my plugin, I will have it use either the library that uses JNI or the FFM one to allow people that have to use an older Java version to use my plugin (backwards compatibility)

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