64,682
社区成员
发帖
与我相关
我的任务
分享
public native short function1(byte[] para1,int para2);
#include<Windows.h>
#include<iostream>
using namespace std;
typedef short (*fit_type)(char[], int);
int main()
{
const char* dllName = "resource_x64.dll";
const char* funName1 = "Java_function1";
char seq1[] = "seq1";
HMODULE hDLL = LoadLibrary(dllName);
if (hDLL != NULL)
{
fit_type function1 = fit_type(GetProcAddress(hDLL, funName1));
if (function1 != NULL)
{
cout << "test start!" << endl;
cout << function1(seq1, 0)<<endl;
}
else
{
std::cout << "Cannot Find Function " << funName1 << std::endl;
}
FreeLibrary(hDLL);
}
else
{
std::cout << "Cannot Find " << dllName << std::endl;
}
return 0;
}
#include<Windows.h>
#include<iostream>
using namespace std;
#pragma comment (lib,"resource_x64.lib")
extern short Java_function1(char seq[], int num);
int main()
{
char seq1[] = "seq1";
cout << "test start!" << endl;
cout << Java_function1(seq1,0)<<endl;
return 0;
}
extern "C" __declspec(dllexport) short Java_function1(char seq[], int num);
Java_function1("seq1",0);
#include<Windows.h>
#include<iostream>
using namespace std;
#pragma comment (lib,"resource_x64.lib")
extern short Java_function1(char seq[], int num);
int main()
{
char* seq1 = new char[5];
seq1 = "seq1\0";
cout << "test start!" << endl;
cout << Java_function1(seq1,0)<<endl;
return 0;
}