I try to create JNI wrapper around the Debenu/PDF Library/DLL/Import/CPlusPlus. I use the CDT plugin for eclipse with MinGW for linking and compiling my code. All the examples I've found are done with WinAPI. I try very simple thing: com_mdm_mie_jniconnector_JniManager.H file: #include <jni.h> /* Header for class com_ricoh_mdm_mie_jniconnector_JniManager */
#ifndef _Included_com_mdm_mie_jniconnector_JniManager #define _Included_com_mdm_mie_jniconnector_JniManager #ifdef __cplusplus extern "C" { #endif /* * Class: com_mdm_mie_jniconnector_JniManager * Method: ping * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_mdm_mie_jniconnector_JniManager_ping (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif ================= com_mdm_mie_jniconnector_JniManager.CPP file:
#include "com_ricoh_mdm_mie_jniconnector_JniManager.h"
#include "DebenuPDFLibraryDLL1016.h" #include <string> #include <iostream>
using namespace std;
/* * Class: com_mdm_mie_jniconnector_JniManager * Method: ping * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_com_mdm_mie_jniconnector_JniManager_ping (JNIEnv *env, jobject obj) { //create the library and release it // Declare and load Quick PDF Library DLL std::string str = "DebenuPDFLibraryDLL1016.dll"; std::wstring temp(str.length(),L' '); std::copy(str.begin(), str.end(), temp.begin());
DebenuPDFLibraryDLL1016 QP(temp);
return JNI_TRUE; }
Error is: >undefined reference to `DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'
I tried:
DebenuPDFLibraryDLL1016 QP("DebenuPDFLibraryDLL1016.dll"); > no matching function for call to 'DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(const char [28])'
DebenuPDFLibraryDLL1016 QP(L"DebenuPDFLibraryDLL1016.dll"); >undefined reference to `DebenuPDFLibraryDLL1016::DebenuPDFLibraryDLL1016(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&)'
I did not find a way to link and compile the DebenuPDFLibraryDLL1016 into my application (which is dll). Here is the command I use: g++ "-IC:\\Program Files\\Java\\jdk1.7.0_21\\include" "-IC:\\Program Files\\Java\\jdk1.7.0_21\\include\\win32" "-IC:\\Program Files (x86)\\Debenu\\PDF Library\\DLL\\Import\\CPlusPlus" -O0 -g3 -Wall -c -fmessage-length=0 -o com_mdm_mie_jniconnector_JniManager.o "..\\com_mdm_mie_jniconnector_JniManager.cpp" g++ -shared -o libwinwrapper.dll com_mdm_mie_jniconnector_JniManager.o
For now it seems I can not create the const std::wstring as it is declared by the constractor: DebenuPDFLibraryDLL1016(const std::wstring& dllFileName);
Please help.
|