⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 《透视Java》的源码
💻 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 + -