https://github.com/joshtynjala/haxe-jvm-jna-call-c-sample
A sample project using the Haxe JVM target to call a function from a C library using JNA
https://github.com/joshtynjala/haxe-jvm-jna-call-c-sample
haxe haxe-jvm haxe-samples jna
Last synced: 2 months ago
JSON representation
A sample project using the Haxe JVM target to call a function from a C library using JNA
- Host: GitHub
- URL: https://github.com/joshtynjala/haxe-jvm-jna-call-c-sample
- Owner: joshtynjala
- Created: 2025-02-07T23:29:39.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-08T00:52:03.000Z (3 months ago)
- Last Synced: 2025-02-16T01:26:07.086Z (2 months ago)
- Topics: haxe, haxe-jvm, haxe-samples, jna
- Language: Haxe
- Homepage:
- Size: 1.84 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Call a C function using the Haxe JVM target
A sample [Haxe](https://haxe.org/) application using the [JVM target](https://haxe.org/manual/target-jvm-getting-started.html) that dynamically loads a C shared library at run-time and calls a native function. Uses [Java Native Access](https://github.com/java-native-access/jna).
## Build
To build the C shared library, see [libhaxejna/README.md](libhaxejna/README.md).
To build the Haxe application, run the following command in a terminal:
```haxe
haxe jvm.hxml
```To start the Haxe application, run the following command in a terminal:
```haxe
java -jar bin/app.jar
```It should print output that looks something like this:
```
adding two ints: 3 + 2
result: 5
```Sample created by [Josh Tynjala](https://github.com/sponsors/joshtynjala), the author of [Feathers UI](https://feathersui.com/) and core contributor to [OpenFL](https://openfl.org/).