日期:2014-05-17 浏览次数:20801 次
//cpp文件代码如下: #include <stdio.h> #include "java2dll.h" JNIEXPORT jstring JNICALL Java_Java2dll_cTrim(JNIEnv *env, jobject obj, jstring str) { const char* strTemp; strTemp=env->GetStringUTFChars(env,str,NULL); if(strTemp==NULL) { return NULL; } cTrim(strTemp); return env->NewStringUTF(env,strTemp); env->ReleaseStringUTFChars(env,str,strTemp); } //.h文件代码如下: /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class Java2dll */ #ifndef _Included_Java2dll #define _Included_Java2dll #ifdef __cplusplus extern "C" { #endif /* * Class: Java2dll * Method: cTrim * Signature: (Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_Java2dll_cTrim(JNIEnv *, jobject, jstring); #ifdef __cplusplus } #endif #endif