Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


using c++ from within higher level languages?

This topic is 7027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?


Share this post

Link to post
Share on other sites
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.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!