2 messages in net.java.dev.jna.usersRe: [jna-users] (Char *) mapping pro...
FromSent OnAttachments
alge...@gmx.deFeb 15, 2008 7:30 am 
Timothy WallFeb 15, 2008 11:10 am 
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] (Char *) mapping problemActions...
From:Timothy Wall (twal@dev.java.net)
Date:Feb 15, 2008 11:10:39 am
List:net.java.dev.jna.users

On Feb 15, 2008, at 10:30 AM, alge@gmx.de wrote:

Hi,

how can I map this function to jna:

void __stdcall getReport(const char *command, char *report)

The variable "report" takes value in this function on native site.

There are several options for generic buffers which are written to by the native call.

* primitive array (byte[] or char[], depending on native string width) * com.sun.jna.Memory (use com.sun.jna.Pointer in the interface) * java.nio.Buffer (use whichever version makes sense for the interface)

Primitive arrays are probably the easiest, while Memory is usually the fastest. Make sure whatever buffer you use is larger than the largest "report" your native method will ever provide, or you will crash the VM.