Question about JNI...

Hi !

I am trying to understand how JNI works to call native code (C++) from Java.

There is something really strange I don’t understand… Here it is:

In the Cocos2dxRenderer.java class, there is the following method:

 public void handleOnResume(){
        nativeOnResume();
    }

Consequently, the nativeOnResume() method (which is in Cocos2dJni.cpp class) is called.

If I change the name of this method from:

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume()

to:

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume2() // Note the "2" at the end of the method name

I would expect that a java.lang.UnsatisfiedLinkError error appears…but everything works like if “nativeOnResume()” calls “void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume2()” without any issues…

I performed a clean of my project but still get this issue… Anybody can tell me what is happening?

Note that if I also change “nativeOnResume()” to “nativeOnResume2()” in handleOnResume() method in order to call void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume2(), I get a java.lang.UnsatisfiedLinkError telling me that nativeOnResume2() cannot be found…

Sorry if my question is stupid but I really can’t figure out what I am doing wrong.

Thanks

OK, found my mistake… For some reasons during mu JNI tests I copied/pasted some time ago the C file from a old Cocos2d-x SDK in my Cocos2d-x v.10 SDK. But actually, the void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume() method used in SDK v.10 is in MessageJni.cpp… (not in this Cocos2dJni.cpp file which has nothing to do in the SDK10…)… It would have helped me if the finder of OSX Lion would not be so buggy and found that there is a nativeOnResume() method in MessageJni.cpp… (found only this occurence only in Cocos2dJni.cpp). I hate OSX Lion ! Sorry to have disturbed this forum with this question.