Problem solved. Thank you for your help!
I made a mistake mapping the function. The C function was returning a
char[] through the parameter. It works now that I have it mapped to a
byte[] in Java. I was crashing the VM when I had it mapped to a
PointerByReference. When it tried to write more than four bytes to the
pointer, it obviously crashed the VM.
My bad,
Cameron
On 11/2/07, Timothy Wall <twal...@dev.java.net> wrote:
On Nov 1, 2007, at 9:20 PM, Cameron Taggart wrote:
I downloaded the latest jna.jar found at https://jna.dev.java.net/
source/browse/jna/trunk/jnalib/dist/
and renamed it to jna-20071029-r346.jar.
I started creating a library interface and was able to get a couple
of functions connected to the .dll quite easily. When I tried
getting a third function to work, the JVM crashes. The
documentation mentions using Native.setProtected(true);, but my JVM
is still crashing. My assumption is that I've got that call in the
wrong place. When/where should I call Native.setProtected(true);?
You need to set it before making the call that causes the problem.
What platform are you on? What does the VM crash dump look like? If
Native.getProtected() returns false after calling setProtected(true),
then protection is not currently supported on that platform.
Even when supported, it's not guaranteed to recover from all causes
of VM crashes, just most memory faults.