Reputation: 73
I am working on a Java project in which I have to use a third party dll (let's say abc.dll). So I created a native header file using JNI.
Then I created a dll project on vs2005 (typical win32 app.) and added that header file created by JNI. I selected clr old syntax support for the project and added the abc.dll as a reference to my project.
Up to now, everything is ok. Here is the problem. I implemented the methods defined in the header file using some methods from the abc.dll. abc.dll has a class called "abc" and that's what I do:
abc *abcObj = new abc(); abcObj->callSomeMethod();
I take a build from the solution, everything is ok. But when I run my Java program, I get an error from the JVM telling that native code broke down?!?! I debugged it and the problem is in new(). It simply cannot instantiate the abcObj.
Then I tried with a c++ app using that abc.dll. It worked.
I think there must be problem with JNI or that managed/unmanaged thing. I am not really experienced at c/c++ so I don't understand so much (at least I don't have time to understand for now). Only thing I try to do is create a wrapper dll using the third party dll and use the wrapper dll in my java app.
Any help will be appreciated.
Thanks in advance...
-haydar
edit: I have all the dlls that are needed by my third party dll.
Upvotes: 0
Views: 238