java调用c++封装的dll

来源:互联网 发布:安川机器人数据下载 编辑:程序博客网 时间:2024/05/17 07:01

 头文件声明:

  /* Header for class com_service_InvocationService */#include "jni.h"#ifndef _Included_com_service_InvocationService#define _Included_com_service_InvocationService#ifdef __cplusplusextern "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;}