Adding native C Code to Squawk
I am currently trying to add functionality, that is for performance reasons coded in C, to Squawk.
As far as I understood there are currently two ways of enhancing Squawk with C code.
1.there is the way of JNA, where libraries can be loaded, and are executed with a TaskExecutor (the native code is run within a native thread)
2.The C code from the VM base, where native method identifiers (defined in Native.java) are mapped to C functions (mostly basic VM functions)
I am looking for a way to keep my C code modular and separated from the basic Squawk code (keep it out of bytecodes.c).
My idea was to link the C code statically to the Squawk binary, and now I am looking for a way, how to call the C functions from Java/ inside Squawk.
Am I overlooking something with this approach?
Are there other successful approaches with the same goal?
Is somewhere a (basic) example available?
I dug through the source code, and googled quite a bit but wasn't able come up with anything.
any help is much appreciated