Writing C-interface for java?

Started by
2 comments, last by Lagge007 20 years, 10 months ago
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
Advertisement
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.
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.
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*/
/*Joe DiMichele C/C++/VB Programmer, A+ Certified Technician AIM:Krawling Khaos, ICQ:332871787 joedimichele@hotmail.com oderint dum metuantExcuse my spelling, programmers can't spel*/

This topic is closed to new replies.

Advertisement