• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

CHAR** and JNA mapping

 
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
For my next trick, I'll need the help of a tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic