Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between JNA and JNR

According to the image from here
enter image description here

both libraries work according to the same principle. But I believe that there is a difference between them. What is this difference?

like image 738
Pavel_K Avatar asked Jun 26 '17 13:06

Pavel_K


2 Answers

JNA uses reflection to call native methods.

JNR generates bytecode in runtime only once therefore JNR works faster then JNA. See example of code generating here

like image 183
Mike Adamenko Avatar answered Nov 16 '22 23:11

Mike Adamenko


The presentation you linked gave part of the answer already - so just continue reading. E.g. on slide 26 and ff:

Why Not JNA?

  • Preprocessor constants?
  • Standard API sets out of the box
  • C callbacks?
  • Performance
like image 20
Lonzak Avatar answered Nov 16 '22 22:11

Lonzak