【发布时间】:2012-10-24 00:15:45
【问题描述】:
我需要在 Java 中获取处理器信息(供应商、型号等)。我通常会使用 C/C++,但不幸的是,对于我当前的项目,这必须在 Java 中完成。我正在使用 JNA 进行本机访问,并且我已将我的 JNA Library 声明如下:
public interface CLibrary extends Library {
public void __cpuid(int[] CPUInfo, int InfoType);
}
我正在尝试这样拨打电话:
CLibrary c = (CLibrary) Native.loadLibrary("msvcrt", CLibrary.class);
int[] CPUInfo = new int[4];
c.__cpuid(CPUInfo, 0);
但是我收到了Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'intrin': The specified module could not be found.,这可能意味着我加载了错误的库。
那么我需要加载什么库才能访问 Windows 上的 __cpuid 函数?
【问题讨论】: