I want with a java programm to call functions from a dll in c.
Created May 4, 2012
Alexander Krapf Dear Stephane,
you have a couple of problems in your approach. Let me address them in sequence:
- You cannot call directly into your DLL. You need to wrap your DLL with a DLL that you build. That DLL will need to implement the native methods that you declare by delegating to the methods in your target DLL.
- String objects are immutable in Java. This means that the outbuf argument must not be a String. You can make it a StringHolder (a class that has a String field that you set with the result) or a character array which you convert to a String.
- You need to be careful with the encoding that is used when you extract bytes from the Java input string. The default encoding might not be the correct one.
Good luck,
Alex