I have a C++ function that uses NewStringUTF like so:

Alexander Krapf

You should show the full snippet, but my suspicion is that you're either not handling an exception that occurred (you're not doing any testing for errors) or that you're using a cached local instance, which you should not.

You should try out JunC++ion from Codemesh Inc., of which I am a principal (just for disclosure's sake). Your example would look like this and it would be guaranteed to work:

  String    str1( columnNames );
  String    str2( formatInfo );

  MyClass::myMethod( tableNum, str1, str2 );

This code would also check for all errors and exceptions and provide you with C++ typesafety, something JNI sorely lacks.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact