View Single Post
  #14  
Old 03-16-2006, 01:34 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Zero Hour
Call me a newb, and paint me green - but couldn't you make some sort of mad C++ DLL that java could use?
You can!

Java methods can be declared "native" which means that they are not implemented in Java but in an external library, in regular machine code. You can then have a program generate a C header file with the C counterparts to the native function's declaration, and then you can implement the functions. The implementation can be in C++ (as long as you do the whole extern "C" thing or in Pascal or ASM or whatever as long as the functions use the expected calling conventions.

Yeah, it is not generally something you want to do all the time, even if you have an existing C++ library, you need to write special wrappers in C and in Java to be able to use it from Java.
Reply With Quote