I need to get processor information (vendor, model, etc.) in Java. I would normally use C/C++ but unfortunately this has to be done in Java for my current project. I am using JNA for native access, and I've declared my JNA Library
as follows:
public interface CLibrary extends Library {
public void __cpuid(int[] CPUInfo, int InfoType);
}
I'm attempting to make the call like this:
CLibrary c = (CLibrary) Native.loadLibrary("msvcrt", CLibrary.class);
int[] CPUInfo = new int[4];
c.__cpuid(CPUInfo, 0);
However I'm getting Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'intrin': The specified module could not be found.
which probably means I'm loading the wrong library.
So what is the library I need to load to get access to the __cpuid
function on Windows?
As __cpuid is a compiler instrinsic (see MSDN) rather than a function, there is no associated DLL. You'll need to write your own.