News for hackers. Stuff that matters.
Re:GTK4 Bindings for Common Lisp by kazinator on Tuesday September 20, 2022 @01:12PM (#32914754)
I'm guessing this is small because it relies on GObject Inspection.

This is a Gnome feature whereby C libraries are accompanied by an XML description of functions and types. The XML description annotates semantics, not only syntax. Like if a function has a pointer parameter, does it have to be malloced, and does the caller free it or the callee? This information is not possible to determine from parsing C header files.

If you can parse the GObject XML, you can then generate FFI bindings (which can be done in Lisp easily without any textual code generation hacks).

Re:GTK4 Bindings for Common Lisp by audidude on Tuesday September 20, 2022 @03:34PM (#32916678)
Before people get too up-in-arms about that being XML, that is just the first step in the GObject Introspection compilation.

The second step builds a .typelib file which is a mmap()'able data-structure used at runtime by dynamic languages. It's smaller as it doesn't contain things like function/class documentation.

Additionally, the language bindings tend to use the GIRepository base structure which handles loading those mmap()'able data structures with an C API on-top of it.

Re:GTK4 Bindings for Common Lisp by kazinator on Tuesday September 20, 2022 @07:40PM (#32919226)
Before people get too up in arms about a C API accessing some binary blobs, rest assured there is XML you could process instead.
Re:GTK4 Bindings for Common Lisp by jmercouris on Tuesday September 20, 2022 @11:57PM (#32920693)
Well, actually not everything possible via CFFI is possible via GIR. I've run into some issues before. I cannot recall what exactly, but it was a showstopper for me :-(.
Re:GTK4 Bindings for Common Lisp by paines on Wednesday September 21, 2022 @10:14AM (#32925443)
Crosscompatiblity? IIRC the same concept was used for some exo-lisp gtk bindings, IIRC fennel, and I couldn't get it work for the life of it under M1 macs....