anyone who regularly works with more than one development language and a third-party library has faced the situation described by: "great library, if only i could have it in my programming language." some vendors make a living from publishing different language versions of their product, but many cant afford or dont want to pay the costs of maintaining several parallel implementations of their product.
consequently, over the years many integration approaches have been created to help us with the common problem of using software written in one language in another language. microsoft has even gone as far as building language inter-operability into the core of its .net platform (of course, they excluded java). when talking about .net, it should also be mentioned that a .net-compatible language has to satisfy many constraints imposed by the .net platform. so many constraints, in fact, that some people have said you dont really write your code in c++ or vb, but rather in a particular dialect of .net. for anybody who is not using .net, or who has to integrate .net with .net-foreign languages such as java, here are the basic integration approaches:
source code translation: translate the java source code of a library to c++.
byte code/binary code translation: take a compiled java class file and compile it into object code. this, as well as the previous approach, can also be referred to as "implementation translation," because the method bodies are converted.
in-process wrapping: create a c++ wrapper for a java type that internally uses jni to delegate from c++ to java.
out-of-process wrapping (remoting): make a java type available to a c++ programmer by calling from the c++ application... 下一页