File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes CHAR** and JNA mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "CHAR** and JNA mapping" Watch "CHAR** and JNA mapping" New topic
Author

CHAR** and JNA mapping

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
I'm very new to JNA and have just succeded in some simple samples. I
now have this function in my h file

__declspec(dllexport) ADK_ERROR __stdcall AdkGetStr(ADK_DATA* pData,
INT iFieldId, CHAR** ppsValue, INT iLen);

Jnarator project set this up as

ByValue AdkGetStr(ADK_DATA pData, int iFieldId, PointerByReference
ppsValue, int iLen);

The ADK_DATA works already since I have used it in oth calls but I
can't succeed to map the CHAR**. I don't know how to use the
PointerByReference.

This is what I've got so far.

PointerByReference ref = new PointerByReference();
ByValue b = lib.AdkGetStr(pData, 12, ref , 16);

I have tested a lot of different values for iLen but it should be 16
since the string that is returned is max 16 characters. Any pointers?

SCJP1.4
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CHAR** and JNA mapping
 
Similar Threads
Need light-weight base64 encoder and decoder for MIDlet
Socket Write Issue
can the following code produces Null pointer exception?‏
code to handle arabic shaping text
Problem with a return with SAX