Wrapping C/C++ inside Java

前端 未结 8 1466
Happy的楠姐
Happy的楠姐 2021-02-07 09:24

I develop applications/programs in C/C++. I am more versed in these two languages and love being a C++ developer. I am wondering how to create a Java program that contains all m

相关标签:
8条回答
  • 2021-02-07 09:45

    I would avoid JNI because it's tedious to write, verbose, and just an altogether pain. Instead I'd use JNA library which makes writing native integration so simple.

    https://github.com/twall/jna/

    Good luck.

    0 讨论(0)
  • 2021-02-07 09:49

    JNI module is not a Java classes. It's C. Using JNI incur many restrictions and some Java environment doesn't support JNI well.

    There is no supported way of "wrap my C++ code inside Java class" (EDIT: I mean, without JNI noway but JNI is problematic.)

    You could investigate custom C++ compiler emit Java byte codes, but nobody (include me) will recommend this approach.

    0 讨论(0)
提交回复
热议问题