public class TestMain {
static {
System.loadLibrary("lib");
}
public native static int multiply(float a, float b);
}
"...\javac.exe" -h . TestMain.java
Rebuild started at 4:05 PM...
1>------ Rebuild All started: Project: Dll1, Configuration: Debug x64 ------
1>dllmain.cpp
1>C:\Users\WhitmemHomeGame\source\repos\Dll1\Dll1\dllmain.cpp(8,10): warning C4244: 'return': conversion from 'jfloat' to 'jint', possible loss of data
1> Creating library C:\Users\WhitmemHomeGame\source\repos\Dll1\x64\Debug\Dll1.lib and object C:\Users\WhitmemHomeGame\source\repos\Dll1\x64\Debug\Dll1.exp
1>Dll1.vcxproj -> C:\Users\WhitmemHomeGame\source\repos\Dll1\x64\Debug\Dll1.dll
1>Done building project "Dll1.vcxproj".
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 4:05 PM and took 03.663 seconds ==========
그러면 제대로 컴파일이 되는 것을 확인할 수 있는데,
25okay
정상적으로 실행되는 것을 확인할 수 있다. 이 방법을 활용해서 윈도우 운영체제에서만 사용 가능한 API 들을 실행할 수 있다. 다음 게시글에서는 윈도우 자체 MessageBox 등을 자바에서 실행해보기로 한다.