跨多种语言的GObject自省 [英] GObject Introspection across multiple languages
问题描述
旧的PyGTK 2.8绑定的Wiki页面指出正确用Python编写的对象
The Wiki page of the old PyGTK 2.8 binding states that an object properly written in Python
还应该可以从C代码甚至其他语言绑定中轻松使用.
should also be easily usable from C code, or even other language bindings.
但是PyGTK已过时,应将其替换为PyGObject.是否也可以将语言与基于自省的较新绑定进行混合和匹配?例如,我可以在Vala中编写一个gobject类,用Python扩展它,然后在Java中使用结果吗?
But PyGTK is outdated and should be replaced by PyGObject. Is it possible to mix and match languages with the newer introspection-based binding, too? For example, can I write a gobject class in Vala, extend it with Python and use the result in Java?
推荐答案
我已经编写了一个基于C的插件库,基本上可以做到这一点.它确实使用了GObject Introspection,并且在理论上是可能的.现在有C/C ++,Python,Lua和SeedJS都在同一个内存空间中一起玩,但是我没有尝试用其他语言来继承或调用C以外的任何东西.
I've written a C based plugin library that does essentially this. It does use GObject Introspection and in theory it is possible. Right now there's C/C++, Python, Lua, and SeedJS all playing together in the same memory space, but I haven't tried to subclass or call anything other than C in the other languages.
无论如何,如果您愿意,可以随时进行修修补补. GPlugin
Anyways, feel free to tinker if you like. GPlugin
这篇关于跨多种语言的GObject自省的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!