| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Foreign Function Interface (ffi) | JNA | Panama: Foreign Function & Memory API | JNI | clong | dtype-next | coffi | javacpp | jextract | JNR | |||||||||||||||||
2 | description: Clojure's java interop provides access to a huge number of high quality libraries. Similarly, the JVM's ffi options provide access to many high quality libraries written in languages like C, C++, Swift, Rust, etc. | ||||||||||||||||||||||||||
3 | Underlying implementation | JNI bindings to libffi | Included in JVM | Included in JVM | JNA, support for Panama or other options likely | JNA, graalvm ffi, java17+ panama | panama | JNI | panama | libffi via jffi | |||||||||||||||||
4 | Widely Supported | widely supported, likely to decline in favor or panama | Available in Java 22+ | widely supported, likely to decline in favor or panama | yes, also extensible | yes, also extensible | Available in Java 22+ | widely supported | Available in Java 22+ | widely supported, likely to be phased out in favor or panama | |||||||||||||||||
5 | Graalvm native image support | yes | partial, https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/foreign-interface/ | yes | yes | yes | partial, https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/foreign-interface/ | yes | partial, https://www.graalvm.org/latest/reference-manual/native-image/native-code-interoperability/foreign-interface/ | probably? | |||||||||||||||||
6 | Automatic API generation | yes, via clong | yes, via jextract | various tools including javacpp | yes | yes, via clong | no, could be supported by clong | yes | yes | ? | |||||||||||||||||
7 | Goofy Javaisms | Yes, structs require bytecode generation or java code | Yes, Java or bytecode generation required for calling native functions | Struct usage is awkward | clojure centric API | clojure centric API | Very Java centric API | ? | |||||||||||||||||||
8 | Performance | Acceptable, but slowest option listed | Best | Similar to Panama | same JNA | same as JNA or java17+ panama | same as panama | same as JNI | same as panama | Similar to JNI | |||||||||||||||||
9 | Requires writing c++ | yes | |||||||||||||||||||||||||
10 | Documentation, examples, tutorials | adequate | adequate | many examples, limited documentation | great documentation, limited examples | ? | many examples, auto generated docs are meh | ? | limited | ||||||||||||||||||
11 | Native datatypes support: ie. support for allocating, reading, writing, and manipulating native datatypes | no missing features, but minimal | no missing features, but minimal | no missing features, but minimal | no missing features, but minimal | yes | DSL for serialization to/from native datatypes | no missing features, but minimal | no missing features, but minimal | ? | |||||||||||||||||
12 | Memory Management Support | minimal | provides support, but mostly diy | no | minimal, but programmatic API generation is well suited to creating higher level APIs which do support automatic memory management | provides some support via various native containers. API is also suitable for building higher level APIs with automatic memory management | yes, but must be specified explicitly | no | no | ? | |||||||||||||||||
13 | Distributing native resources: ie. support for distributing native resources in jars and loading them. | Includes library loader that can extract libraries from jars | No support | ? | same as JNA, Includes library loader that can extract libraries from jars | same as JNA, Includes library loader that can extract libraries from jars | No support | Yes, provides tools and library loader | No support | No support | |||||||||||||||||
14 | Extensible | no | no | no | yes, can be extended to new ffi implementations and API supports custom code generation | yes, can be extended to new ffi implementations. also provides protocols that can be extended for other purposes | supports custom serialization. | ? | ? | ? | |||||||||||||||||
15 | |||||||||||||||||||||||||||
16 | |||||||||||||||||||||||||||
17 | |||||||||||||||||||||||||||
18 | |||||||||||||||||||||||||||
19 | |||||||||||||||||||||||||||
20 | |||||||||||||||||||||||||||
21 | |||||||||||||||||||||||||||
22 | |||||||||||||||||||||||||||
23 | |||||||||||||||||||||||||||
24 | |||||||||||||||||||||||||||
25 | |||||||||||||||||||||||||||
26 | |||||||||||||||||||||||||||
27 | |||||||||||||||||||||||||||
28 | |||||||||||||||||||||||||||
29 | |||||||||||||||||||||||||||
30 | |||||||||||||||||||||||||||
31 | |||||||||||||||||||||||||||
32 | |||||||||||||||||||||||||||
33 | |||||||||||||||||||||||||||
34 | |||||||||||||||||||||||||||
35 | |||||||||||||||||||||||||||
36 | |||||||||||||||||||||||||||
37 | |||||||||||||||||||||||||||
38 | |||||||||||||||||||||||||||
39 | |||||||||||||||||||||||||||
40 | |||||||||||||||||||||||||||
41 | |||||||||||||||||||||||||||
42 | |||||||||||||||||||||||||||
43 | |||||||||||||||||||||||||||
44 | |||||||||||||||||||||||||||
45 | |||||||||||||||||||||||||||
46 | |||||||||||||||||||||||||||
47 | |||||||||||||||||||||||||||
48 | |||||||||||||||||||||||||||
49 | |||||||||||||||||||||||||||
50 | |||||||||||||||||||||||||||
51 | |||||||||||||||||||||||||||
52 | |||||||||||||||||||||||||||
53 | |||||||||||||||||||||||||||
54 | |||||||||||||||||||||||||||
55 | |||||||||||||||||||||||||||
56 | |||||||||||||||||||||||||||
57 | |||||||||||||||||||||||||||
58 | |||||||||||||||||||||||||||
59 | |||||||||||||||||||||||||||
60 | |||||||||||||||||||||||||||
61 | |||||||||||||||||||||||||||
62 | |||||||||||||||||||||||||||
63 | |||||||||||||||||||||||||||
64 | |||||||||||||||||||||||||||
65 | |||||||||||||||||||||||||||
66 | |||||||||||||||||||||||||||
67 | |||||||||||||||||||||||||||
68 | |||||||||||||||||||||||||||
69 | |||||||||||||||||||||||||||
70 | |||||||||||||||||||||||||||
71 | |||||||||||||||||||||||||||
72 | |||||||||||||||||||||||||||
73 | |||||||||||||||||||||||||||
74 | |||||||||||||||||||||||||||
75 | |||||||||||||||||||||||||||
76 | |||||||||||||||||||||||||||
77 | |||||||||||||||||||||||||||
78 | |||||||||||||||||||||||||||
79 | |||||||||||||||||||||||||||
80 | |||||||||||||||||||||||||||
81 | |||||||||||||||||||||||||||
82 | |||||||||||||||||||||||||||
83 | |||||||||||||||||||||||||||
84 | |||||||||||||||||||||||||||
85 | |||||||||||||||||||||||||||
86 | |||||||||||||||||||||||||||
87 | |||||||||||||||||||||||||||
88 | |||||||||||||||||||||||||||
89 | |||||||||||||||||||||||||||
90 | |||||||||||||||||||||||||||
91 | |||||||||||||||||||||||||||
92 | |||||||||||||||||||||||||||
93 | |||||||||||||||||||||||||||
94 | |||||||||||||||||||||||||||
95 | |||||||||||||||||||||||||||
96 | |||||||||||||||||||||||||||
97 | |||||||||||||||||||||||||||
98 | |||||||||||||||||||||||||||
99 | |||||||||||||||||||||||||||
100 |