View Single Post
  #2   Spotlight this post!  
Unread 28-12-2010, 00:56
derekwhite's Avatar
derekwhite derekwhite is offline
Java Virtual Machine Hacker
no team (FIRST@Oracle)
Team Role: Programmer
 
Join Date: May 2009
Rookie Year: 2009
Location: Burlington, MA
Posts: 127
derekwhite is on a distinguished road
Re: Native C string (char*) to java String

I don't see a killer bug, but there is one thing to clean up.

1) Each call to Pointer.createStringBuffer() essentially "mallocs" a new C string buffer, so you typically need to free it after calling the C function (unless the C code stashes the value somewhere to use later). To fix this, create a local Pointer variable, say "ptr", and call ptr.free() after the call out to C.

Also, I'm not sure what died, and what the symptoms are. Something on the cRIO or the driver station?

And I couldn't find the C code for ZomBDashboardGetString(), etc. Is it in the svn somewhere?

Good luck!
Reply With Quote