• Post Reply Bookmark Topic Watch Topic
  • New Topic

JNI mapping to pass reference from Java to C  RSS feed

 
Chandra shekar M
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

//In java
I'll have StringBuffer buffer = new StringBuffer();
I want to pass this to native call which will populate "hellow" in that

//In C++
int hellow(char *buffer){

buffer ='hellow';
return 0;
}

when the control returns from C to java, I should be able to print buffer and "hellow" string the .

What is the JNI call that I should make to map the buufer in Java to pointer in C code ?

Thanks,
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can refer here.
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I searched for Java Native Interface tutorial and there were lots of hits: try 1 2 3 Note No 3 is from IBM, so that one may be good.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!