简体   繁体   中英

Generating Java binding to a Qt based library

I'm writing a Qt based (QtCore) C++ library and would 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM