I'm writing a Qt based (QtCore) C++ library and woul开发者_如何学Pythond like to have access to it from Java and Python. Python is not a problem because of PySide and SIP. But I can't seem to find any information about doing the same with Java. The fact that Java bindings exist for Qt makes me hopefuly that there is a way to create bindings for a custom Qt based library.
Has anyone done this? Or have any information or pointers on how this can be done?
Qt Jambi included a generator that you could use on your own Qt classes.
However, Nokia discontinued support for Jambi after v4.5.
For technical details, see http://doc.qt.nokia.com/qtjambi-4.5.0_01/com/trolltech/qt/qtjambi-generator.html .
Also, there's an early white paper still at http://www.sra.co.jp/qt/relation/qtjambi-whitepaper-tp3.pdf with details of the generator in chapter 4.
http://www.swig.org/ has a program called swig. This program allows you to generate bindings
, which create functions in languages like Java or Python that simply call the appropriate C(++) function For example if you have a C++ function int add(int x, int y)
, running the prototype/definition through SWIG would create a Java wrapper that would call that function. Any libraries the C code uses are irrelevant.
精彩评论