8 messages in net.java.dev.jna.usersRe: [jna-users] where to call Native....
FromSent OnAttachments
Cameron TaggartNov 1, 2007 6:20 pm 
Cameron TaggartNov 1, 2007 6:21 pm 
Timothy WallNov 2, 2007 6:15 am 
Cameron TaggartNov 2, 2007 11:11 am 
Timothy WallNov 2, 2007 11:58 am 
Cameron TaggartNov 2, 2007 12:44 pm 
Timothy WallNov 2, 2007 5:45 pm 
Cameron TaggartNov 6, 2007 5:40 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] where to call Native.setProtected(true);Actions...
From:Cameron Taggart (came@gmail.com)
Date:Nov 6, 2007 5:40:10 pm
List:net.java.dev.jna.users

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.