Jump to content
  • Advertisement

Archived

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

Lagge007

Writing C-interface for java?

This topic is 5579 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

I''ve written a fairly basic C++class and was wondering if it''s possible to write some sort of interface to that class in order for a partner to access the functions, using java. (we''re trying to learn to make such an interlanguage interface for fun, the fact that one uses c++, the other java is rather offtopic here) The ultimate goal is to make an ''c++ engine'' whereas someone else could program in java/vb/etc to make a frontend/gui using this engine without to much of a hassle on that side (in other words: the ''engine'' should take care of most of the interlanguage conversions etc) Anyone has some good starting points because I really don''t have a clue were to start. Do I need to write a ''java-interface'' and make a dll out of the whole class? How does the java/vb/etc user needs to implement the ''engine''? Any help would be greatly apreciated

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I don''t know about java, but you can make interlanguage communication with c++ and vb. You''ll have to put your c++ code in a dll or com module, and you''ll be able to use it from vb. I''m not a vb programmer so I can''t tell you how the vb code is going to be for it to work. It''s also possible to interface c++ with assembly, but that''s much harder.

Share this post


Link to post
Share on other sites
quote:
Original post by Lagge007
I''ve written a fairly basic C++class and was wondering if it''s possible to write some sort of interface to that class in order for a partner to access the functions, using java.

Yes! The Java Native Interface is one option. Other interoperability mechanisms include CORBA, COM, or TCP/IP with a custom protocol. Which one is best depends on your requirements.
quote:

The ultimate goal is to make an ''c++ engine'' whereas someone else could program in java/vb/etc to make a frontend/gui using this engine without to much of a hassle on that side (in other words: the ''engine'' should take care of most of the interlanguage conversions etc)

I recommend you investigate existing interoperability mechanisms first. Its a rather complicated topic. You might also look into mechanisms for different language combinations, like Boost.Python, SWIG, Lisp FFI, etc.

Share this post


Link to post
Share on other sites
I''m too sure if this will work for Java but, but with Visual Basic I believe that you just write a dll in C++, link it into VB and use the commands

/*Joe DiMichele
C/C++/VB Programmer, A+ Certified Technician
AIM:Krawling Khaos, ICQ:332871787
joedimichele@hotmail.com
oderint dum metuant
Excuse my spelling, programmers can''t spel*/

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!