现在的位置: 首页 > 综合 > 正文

cocos2d-x 使用JNI从Java调C++

2013年10月10日 ⁄ 综合 ⁄ 共 218字 ⁄ 字号 评论关闭

最近项目中涉及到Android的移植,要用到java调用c++,方法其实也很简单。

假设java这边我需要调用C++那边的函数void PaySuccess(int type);

1、在java这边申明

1 private

static

native
void

nativePaySuccess(
int

i);

调用时,

1 nativePaySuccess(1);

这样java会调用到C++那边。

2、C++那边实现该方法:

01 #include
<jni.h>
02  

抱歉!评论已关闭.