When making language bindings, are there any license restrictions? I know my generator program can be of any license, but what about the generated or handwritten bindings code, which is technically a derived work from the C headers and GIR as far as I understand?
Disclaimer: I am not a lawyer. If you want legal advice, go ask a real lawyer.
Language bindings exist in two different varieties, assuming you’re using the introspection data that GLib, GTK, and other GObject-based libraries provide. If you’re using the binary typelib data to resolve symbols, then it’s entirely immaterial which license you use: the binary data is loaded at run time, and contains only the ABI description of the library, so it’s similar to using dlopen()
to open a shared library and calling dlsym()
to get its symbols.
If you’re using the comprehensive GIR data to generate trampolines into the C API then you fall into the same category as consuming the C API in an application, which means you have to follow the same restrictions as any other consumer of the library.
In short: the license of your bindings can be anything that is compatible with the license of the library you’re using. If you’re generating bindings for GLib or GTK, you can use whatever license you want, as those libraries use the LGPL; if you’re generating bindings for Poppler or libgweather, then the final code must be released under the terms of the GPL.
Finally, the code generator itself can be released under any licensing terms you want, because it’s taking an input and generating an output, and as such it’s not a derived work of the input. Otherwise, the C compiler would have to be released under the same terms of the header files used to compile your application.
Generating code calling C symbols is not going to create a derived work, otherwise any C program using GLib would be a derived work of GLib, which is patently untrue.
Thanks for clearing that up! The topic may be considered closed then