1

I'm a Java developer.

I have a source code of a project in C/C++, which has an interface in C.

I need to wrap it into Java. I guess I'll use JNI (Edit : or JNA would be used).

My question is :

What is the "wrappable" part? Should I wrap source code or the compiled version?

For the fact that I need to access to the interface (*.h), should I wrap :

  • *.DLL
  • *.LIB
  • *.h

Thank you a lot.

user3169231
  • 257
  • 3
  • 13
  • Have you looked at Java Native Access instead? It may be more suitable. Regarding what to wrap, it depends on the particulars, but usually you'd make the Java API a client of the C shared library (DLL) just like any other program that uses it. – chrylis -cautiouslyoptimistic- Feb 05 '14 at 12:48
  • 1
    You need both .h (to code your JNI Library against) and the DLL at runtime. – Gyro Gearless Feb 05 '14 at 12:57
  • Thank you both (@chrylis + @Gyro) for your answers. Would it be the same in case of using JNA as suggested by @chrylis ? – user3169231 Feb 05 '14 at 13:21
  • See also http://stackoverflow.com/questions/1556421/use-jni-instead-of-jna-to-call-native-code – technomage Feb 05 '14 at 17:12

0 Answers0