GIWS (software)
≈ 1 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
GIWS is a wrapper generator intended to simplify calling Java from C or C++ by automatically generating the necessary JNI code. It was started by Sylvestre Ledru for Scilab as part of the project's move to Java. GIWS is released under the CeCILL license.
GIWS is a wrapper generator intended to simplify calling Java from C or C++ by automatically generating the necessary JNI code. It was started by Sylvestre Ledru for Scilab as part of the project's move to Java. GIWS is released under the CeCILL license. package basic_example; import java.lang.Math; public class MyComplexClass { public MyComplexClass() { // the constructor } public long myVeryComplexComputation(double a, double b) { return Math.round(Math.cos(a) + Math.sin(b) * 9); } } GIWS gives the capability to call it from C++. include include "basic_example.hxx" include JavaVM* create_vm() { JavaVM* jvm; JNIEnv* env; JavaVMInitArgs args; JavaVMOption options[2]; args.version = JNI_VERSION_1_4; args.nOptions = 2; options[0].optionString = const_cast ("-Djava.class.path=."); options[1].optionString = const_cast ("-Xcheck:jni"); args.options = options; args.ignoreUnrecognized = JNI_FALSE; JNI_CreateJavaVM(&jvm, (void **)&env, &args); return jvm; } using namespace basic_example; using namespace std; int main() { JavaVM* jvm = create_vm(); MyComplexClass *testOfMyClass = new MyComplexClass(jvm); cout myVeryComplexComputation(1.2,80) To generate the binding, GIWS uses a XML declaration. GIWS will generate the JNI code to call the Java object. ==References==
Text derived from https://en.wikipedia.org/w/index.php?oldid=1368140869 under CC BY-SA 4.0; modifications have been made.