2 messages in net.java.dev.jna.usersRe: [jna-users] JNA NullPointerException
FromSent OnAttachments
ilya...@mail.ruMay 20, 2008 8:19 am 
Timothy WallMay 20, 2008 8:36 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] JNA NullPointerExceptionActions...
From:Timothy Wall (twal@dev.java.net)
Date:May 20, 2008 8:36:47 am
List:net.java.dev.jna.users

Multi-dimensional arrays are not automatically mapped by JNA. The primary reason is that Java multi-dimensional arrays are not contiguous in memory, while most native multi-dimensional arrays are. Auto-converting would require non-trivial memory management and copying of data to fit into the native space, and require several alternatives depending on the actual native layout desired. If you think this is a worthwhile feature, feel free to submit an RFE at
https://jna.dev.java.net/servlets/ProjectIssues , with use cases.

See additional comments below:

On May 20, 2008, at 11:19 AM, ilya@mail.ru wrote:

Hi!

I've create simple application for test calling of dll functions and receive NullPointerException:

public static class ArrayClass { public byte[][] list = new byte[16][256]; }

public static class TextList extends Structure { public int count; public byte list[][] = new byte[16][128]; }

struct TTextList{ int Count; char List[16][128]; };

There is no automatic mapping from Java multi-dimensional arrays to native multi-dimensional arrays. You can provide an implementation of NativeMapped to do so, or simply store the data in a single Java array of sufficient size.

BTW, you need to be subscribed to the users list in order to post.