javadlljnaerator

Call dll (C++ library) methods from Java


I have .dll library with header file written in C++ (no source code available). This library uses some another .dll files - i have them too. My task is to use this library from Java (call methods and receive results).

I found that it is possible to use JNAerator for this purpose. What algorithm will be? I tried java -jar jnaerator.jar MyLib.dll MyLibHeader.h command but it outputs

 ERROR: JNAeration failed ! 

     Missing output mode parameter -mode !
     Please use -h for help on the command-line options available.

How to use -h for help? Which -mode i need? There is only one dll in example command but i want to use three of them as they depends on each other.

May be it is more suitable tool for my task? (Some tutorials will be appreciated). Thanks.


Solution

  • You need to specify the -mode argument in your command line. Their Google Code page has this to say:

    -mode [mode: 'Jar' : JAR with bindings only | 'StandaloneJar' : JAR with bindings and runtime dependencies | 'Directory' : Bindings sources in simple file hierarchy | 'Maven' : Bindings sources in Maven project ready to build | 'AutoGeneratedMaven' : Maven project that automatically regenerates its bindings>]

    Let's say you use 'StandaloneJar', then your command line would be: java -jar jnaerator.jar -mode StandaloneJar MyLibHeader.h MyLib.dll.

    I hope it works, since I have absolutely no experience with JNAenerator!