Jnative的调用dll文件

初次尝试缺发生异常:org.xvolks.jnative.exceptions.NativeException: Function Decrypted not found
说我的方法没有找到,所以查了一下资料,通过确认,是生成dll文件的时候,方法名给优化了,解决办法:
#ifndef __DES3_H__
#define __DES3_H__

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include "string.h"

using namespace std;

#define SUCCESS 0
#define FAIL 1

#define DESENCRY 0
#define DESDECRY 1

[color=red]#define LIBEXPORT_API extern "C" __declspec(dllexport)[/color]
一定要把声明继承C的标准,然后生成的dll文件中的方法名就不会改变,就可以解决上面的异常了。
typedef unsigned char UChar;
static const char *tostring="0123456789ABCDEF";
class Des
{
public:
Des(void);
~Des(void);
public:
UChar* Encrypt(UChar *data, UChar *key,int readlen);
UChar* Decrypted(UChar *data,UChar *key,int readlen);
UChar* Encrypt3(UChar *data, UChar *key,unsigned int n ,unsigned int readlen);
UChar* Decrypted3(UChar *data,UChar *key,unsigned int n ,unsigned int readlen);
UChar* EncryptN(UChar *data, UChar **key, unsigned int n_key,unsigned int readlen);
UChar* DecryptedN(UChar *data, UChar **key, unsigned int n_key,unsigned int readlen);
private:
int handle_data(unsigned int *left , int choice);
int makedata(unsigned int *left ,unsigned int *right ,unsigned int number);
int makefirstkey( unsigned int *keyP );
int makekey( unsigned int *keyleft,unsigned int *keyright ,unsigned int number);

};

LIBEXPORT_API unsigned char* DesEncrypt(unsigned char *data,unsigned char *key,int readlen);
LIBEXPORT_API unsigned char* DesDecrypted(unsigned char * data,unsigned char *key,int readlen);

#endif
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值