How Would I Create Bindings to a GUI toolkit like GTK, Tk, or Qt for a Programming Language?

softwareengineering.stackexchange https://softwareengineering.stackexchange.com/questions/406013

  •  08-03-2021
  •  | 
  •  

Question

The title says it all. How would I, in theory, create a binding for different GUI toolkits for a programming language that has no GUI bindings. I ask because I want to experiment with this sometime in the future.

Était-ce utile?

La solution

You would use the language's foreign function interface (FFI) to call out to the C bindings. You can look at how other languages have done this, like pygobject. It's not easy though. You have to understand the C implementation very well, and your FFI very well. If your goal is to learn how to do the bindings, it might be worth it. If your goal is to create a GUI desktop application in your language, there are probably easier options.

Licencié sous: CC-BY-SA avec attribution
scroll top