I wrote an agent for Java which does nothing just exports two methods, just to check if it loaded on JVM start or not. Built it with mingw-w64 4.8.4 (using JetBrains CLion). Windows 7 x64.
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved){
return JNI_OK;
}
JNIEXPORT void JNICALL
Agent_OnUnload(JavaVM *vm){}
Got an error running
java -agentlib:"C:\JMVAgent\agent.dll"
Error occurred during initialization of VM
Could not find agent library libSampleAgent.dll on the library path,
with error: Can't find dependent libraries
Also I placed agent.dll into c:\windows\System32 and run java w/o agent full path with the same result.
DependencyWalker shows no dependency error
Please help to find what I'm doing wrong