4 messages in net.java.dev.jna.usersRe: [jna-users] Mapping two-dimension...
FromSent OnAttachments
Albert StrasheimAug 29, 2007 1:41 pm 
Timothy WallAug 29, 2007 3:30 pm 
Albert StrasheimSep 12, 2007 2:14 pm 
Albert StrasheimSep 12, 2007 2:47 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] Mapping two-dimensional arraysActions...
From:Timothy Wall (twal@dev.java.net)
Date:Aug 29, 2007 3:30:57 pm
List:net.java.dev.jna.users

There isn't any direct mapping, since there isn't a canonical two- dimensional data layout in C.

You'll have to set up the data manually, or create a class to handle the layout. See StringArray in Function.java; it maintains an array of char*, which might be similar to what you're doing.

Figure out what your data should look like on the Java side, then do the conversion to a Pointer type.

If you want your defined interface to take a two-dimensional java array, e.g.

void foo(int[][] data)

then you'll need to define a type mapper which converts the java type int[][] into a type the invocation layer can handle (namely, Pointer).

On Aug 29, 2007, at 4:42 PM, Albert Strasheim wrote:

Hello all

I'm trying to map a function that takes a two-dimensional array parameter, like:

void foo(int* bar[]);

or equivalently:

void foo(int** bar);

I took a quick look at the JNA unit tests, but I couldn't find an obvious example of how to map this kind of parameter.

Any help would be appreciated.

Cheers,