java呼叫c++封裝的dll
阿新 • • 發佈:2019-02-10
標頭檔案宣告:
/* Header for class com_service_InvocationService */
#include "jni.h"
#ifndef _Included_com_service_InvocationService
#define _Included_com_service_InvocationService
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: com_service_InvocationService
* Method: execute
*/
JNIEXPORT void JNICALL Java_com_service_InvocationService_execute
(JNIEnv *, jobject, jstring);
{
//在這裡新增任意程式碼
}
cpp檔案,實現
#include <iostream.h>
#include <string.h>
#include "com_service_InvocationService.h"
JNIEXPORT void JNICALL Java_com_service_InvocationService_execute
(JNIEnv *, jobject, jstring)
{
//在這裡新增任意程式碼
return;
}