View Single Post
Old 01-13-2006, 04:09 AM   #3
Kastagaar
Member
 
Join Date: Apr 2002
Location: Hampshire, UK
Posts: 117
Kastagaar is on a distinguished road
Send a message via Yahoo to Kastagaar
I agree with KaVir: how bizarre, how bizarre.

The first thing that you should recognise is that Java and C++, despite their apparent syntactic similarities, are completely different languages in almost every respect.  How you do things is just plain different.

That said, Java does have an interface to external code via the JNI - Java Native Interface.

Essentially, you can design a Java class, and mark methods as "native".

[code] public class Foo
{
   public native void stuff();
}
[/quote]

After compiling this class, you can extract a C++ header from it using the "javah" tool.  Then, you can use that header as a basis to implement those methods marked native in C++.  You then compile it into a DLL (presuming some compiler capable of this), and that code will run when that native method is called.
Kastagaar is offline   Reply With Quote