🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

using c++ from within higher level languages?

Started by
0 comments, last by Nomad 24 years, 9 months ago
Hi, my friend and I are making a chess game for windows. I unfortunately am in charge of coding the GUI. Now I know it would probably be the best thing to learn the win32 api but with school i just don't have the free time. Anyway, I want to use windows for the GUI (obviously) but i want to write the actual windowing system in a high level language ( I am looking into Java, and TCL\TK} I need to know how to call the c++ program to run in a TCL\TK or java window, cause this is a c++ learning project for my friend and i otherwise we would just use java the whole way through. Anyway any info there would be helpful. Also is it possible to do graphics with OpenGL using C++ within a Java or TCL\TK window?

THANX FOR YOUR COMMENTS,
NOMAD

Advertisement
I dunno about TCL/Tk, but calling C++ code from Java is easy. Look at the Java Native Interface in the JDK 1.1+ docs.

Basically you run a command line utility (javah, comes with the JDK) that automatically generates headers for methods you declare native in the Java object. You fill in the implementation of the native method. The JNI api allows you, from C++, to access fields of Java objects, call Java methods, create Java objects, and pretty much anything you would want/need to do.

------------------
-vince


-vince


This topic is closed to new replies.

Advertisement