Sign in to follow this  

supported and are written using the maddenvip

Recommended Posts

mmogo    0

An integer, so we write that as "I".Custom types are also supported and are written using the fully-qualified name, a prefix of "L", and a suffix of ";". For example, a signature of Madden NFL 18 Coins "(Ljava/util/ArrayList;)Z" describes a function that takes a java.util.ArrayList instance and returns a boolean (which is what the "Z" stands for).In C/C++, the jobject data type is used for non-primitive types. Let's assume we already have the method handle plus a jobject named "testClassInstance". Now,


call the ComputeMult function:jfloat a = 4.0f;jfloat b = 0.5f;jint result = env->CallIntMethod(testClassInstance, computeMultHandle, a, b);The "result" integer variable should now hold a value of 2.Creating An Instance Of A Java Class In C/C++In the previous section we called a function on Cheap NFL 18 Coins an existing Java object. But what if we want to create our own instance? Let's create a TestClass object:jclass testClassHandle = env->FindClass("com/adbad/jnitest/TestClass");


testClassCtor = env->GetMethodID(testClassHandle, "", "()V");jobject testClassInstance = env->NewObject(arrayListClass, arrayListCtor);As you can see, getting a handle to the constructor is the same as getting any other member function. The only difference is that "" is used as the function name. To create the instance, we use the JNIEnv's "NewObject" method and pass in the class and constructor handles.Helpful


qid=20080326074018AAarBJ9http:java.sun/docs/books/jni/html/[This piece was reprinted from AltDevBlogADay, a shared blog initiative started by mike_acton devoted to giving game developers of all disciplines a place to maddenvip  motivate each other to write regularly about their personal game development passions.

Share this post

Link to post
Share on other sites

Смотрите также:

This topic is now closed to further replies.
Sign in to follow this