Hi,
I'm using JNA to work on a binding to the Jack Audio Connection Kit at
the moment as I need access to the API for a current project, and
while there is an existing project using custom JNI (JJack) it doesn't
offer the level of access to the underlying API that I'm looking for.
There is a little extra overhead from using JNA, but it's definitely
workable (low latency in a realtime thread), and that's without trying
direct mapping yet!
Anyway, I've got a question concerning a number of methods that return
an array of strings ( as const char ** ). According to the Jack API,
I need to free the returned memory, so I'm returning them as a Pointer
in the JNA interface and creating a String[], but then what's the best
way to free this memory? I tried the method of wrapping the free()
method in the CLibrary as has been suggested previously, but this
crashes the VM. However, if I create the free() method in the
JackLibrary interface, it all works fine. I don't know enough about C
to know if this is normal to access a function through a library
that's been compiled against. Is this way of doing it liable to
break?
btw - JNAJack is going up at
http://code.google.com/p/java-audio-utils/ - the download is just a
'proof of concept', but the code I'm working on is in the SVN repo.
Thanks and best wishes,
Neil