- #include <jni.h>
- #include "com_test_Test.h"
- #include <stdio.h>
- #include <stdlib.h>
- #include <strings.h>
- //获取字符串
- JNIEXPORT void JNICALL Java_com_test_Test_sayHello(JNIEnv * env, jobject obj,
- jstring s) {
- char * str = (char *) (*env)->GetStringUTFChars(env, s, 0);
- printf("\n c-string: hello - %s", str);
- }
- //获取,返回int
- JNIEXPORT jint JNICALL Java_com_test_Test_add(JNIEnv * env, jobject obj,
- jint a, jint b) {
- int i = a;
JNI:基本数据类型转换
最新推荐文章于 2021-02-24 03:14:36 发布