java calling C

Ray Holme rayholme@yahoo.com
Mon Aug 22 13:46:00 GMT 2005


I have been so far successful in passing java numbers
(all types)  to C routines. What I have failed at is
dealing with passing and returning Strings. I have
tried to pass byte[] and char[] stuff instead and the
results have been less than thrilling. I am trying to
deal with some things in C that cannot be dealt with
nicely in Java. I believe the best way to pass a true
String object and know how to deal with that.

   1)   can someone point me to what the String struct
looks like?
        I need two things - the string array itself
and its length()  
   2)   how do I translate a unicode short to a char +
vice versa?
   3)   how can I malloc a new String in C so that
Java garbage collection will free it later?

Thanks for any clues you can provide - even pointing
me to the correct source code to start with is a good
start (I am using gcc 3.3.3 currently as it is
compatible with other things that break in 3.4 - GCC
does not break, they do as the standards are
enforced).

Ray


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



More information about the Gcc-help mailing list