I'm trying to load custom c++ dll (using jni) to java, but i have a problem: my dll using cryptopp library, and when java tries to load depending (including cryptopp), the application quits with the message:
Java Result: -1073741571
What is that, can i fix this without removing cryptopp?
Update:
If i commented files zCypto.h and zCypro.cpp, and deleted all usage of cryptopp library, it works without any errors, error has thrown if i load cryptopp. Java code:
public static void main(String[] args){
System.loadLibrary("cryptopp");
System.loadLibrary("ZCPP_Code64");
}
CPP Source (I make dll in Visual Studio 2012):
#include "zCrypto.h"
JNIEXPORT void JNICALL Java_ru_zontwelg_Loader_loadCache
(JNIEnv *env, jobject jobj)
{
std::fstream stream;
stream.open("C:\\testing_capturing\\enc.zwac", ios_base::binary | ios_base::in);
// Other decode & read stuff here ...
stream.close();
}
Header:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class ru_zontwelg_Loader */
#ifndef _Included_ru_zontwelg_Loader
#define _Included_ru_zontwelg_Loader
extern "C" {
/*
* Class: ru_zontwelg_Loader
* Method: loadCache
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_ru_zontwelg_Loader_loadCache
(JNIEnv *, jobject);
}
#endif
zCrypto.h:
#ifndef ZontWelg_zCrypto
#define ZontWelg_zCrypto
#include <dll.h>
#include <cstdio>
#include <Windows.h>
#include <iostream>
#include "cryptlib.h"
using CryptoPP::Exception;
#include "hex.h"
using CryptoPP::HexEncoder;
using CryptoPP::HexDecoder;
#include "base64.h"
using CryptoPP::Base64Encoder;
using CryptoPP::Base64Decoder;
#include "filters.h"
using CryptoPP::StringSink;
using CryptoPP::StringSource;
using CryptoPP::StreamTransformationFilter;
#include "sha.h"
#include "rsa.h"
#include "hex.h"
#include "osrng.h"
#include "secblock.h"
#include "modes.h"
#include "aes.h"
using CryptoPP::AES;
//#include "ccm.h"
using CryptoPP::CBC_Mode;
#pragma comment(lib, "cryptlib.lib")
//#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "cryptopp.lib")
using namespace std;
class zCrypto {
public:
static string base64(string in);
static string from_base64(string in);
static string decrypt(const std::string& str_in);
};
#endif