Skip to content

Instantly share code, notes, and snippets.

View mpolak's full-sized avatar

Michal Polák mpolak

  • Brno, Czech Republic
View GitHub Profile
@mpolak
mpolak / JNI.cpp
Created October 10, 2011 06:41
Proper method to create jstrings from Native Strings
/*
http://java.sun.com/docs/books/jni/html/other.html
8.2.1 Creating jstrings from Native Strings
*/
jstring JNI::JNU_NewStringNative(JNIEnv *env, const char *str)
{
jstring result;
jbyteArray bytes = 0;
int len;