In Narwhal, we are using JNA to make libc
calls like getcwd
and chdir
. I've only been able to use this with my limited knowledge of the JNA interface as it pertains to JavaScript in Rhino, dealing exclusively with primitives. I need to know how to allocate a char buffer so I can pass it to getcwd
, retrieve a JavaScript String from that buffer, and deallocate the buffer, presumably in a finally
clause.
Here's how we grab the libc
interface:
Here's how chdir
is implemented:
Here's where we need the solution for getcwd
Solutions in Ruby or any other embedded language for JNA would help.