📄 main.c
字号:
/*
* Implementation of native methods that access OS thru Win32 API
*/
#include <windows.h>
#include "covertjava_nativecode_OSMemoryInfo.h"
typedef JNIEXPORT jlong (JNICALL* FuncType) (JNIEnv *, jclass);
int main(char** args)
{
HMODULE hMod = LoadLibrary("OSMemoryInfo.dll");
FuncType pFunc = (FuncType)GetProcAddress(hMod, "_Java_covertjava_nativecode_OSMemoryInfo_getPhysicalTotal@8");
jclass cls;
int total = -1;
if (hMod == 0 || pFunc == 0) {
printf("ERROR: Got hMod = %d, func = %d\n", (int)hMod, (int)pFunc);
return 1;
}
total = pFunc(0, cls);
printf("Total = %d\n", total);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -