📄 globalreflibrary.cpp
字号:
// GlobalRefLibrary.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "..\GlobalRefExample.h"
JNIEXPORT void JNICALL Java_GlobalRefExample_testGlobalRef
(JNIEnv *env, jobject obj)
{
static jstring globalString = NULL;
const char *gStr;
if(globalString == NULL) {
// First time through, create global reference
jstring localStr;
localStr = env->NewStringUTF("This is a string");
if(localStr == NULL) {
return;
}
printf("Global reference does not exist, creating...\n");
globalString = (jstring)env->NewGlobalRef(localStr);
}
gStr = env->GetStringUTFChars(globalString, NULL);
printf("The contents of globalString: %s\n", gStr);
fflush(stdout);
env->ReleaseStringUTFChars(globalString, gStr);
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -