I am coding a Java Agent library. However, the JVM cannot find Agent_OnLoad function even if I have explicitly exported it in my C++ code.
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM* vm, char* options, void* reserved)
{
return JNI_OK;
}
It then says Could not find Agent_OnLoad function in the agent library: ./FuncTest.dll. The start-up command line is java -agentpath:./FuncTest.dll -jar .\helloworld.jar
Using Visual Studio 2022, Corretto 17.0.8
.DEFfile to name the export properly. It may be getting exported like_Agent_OnLoador_Agent_OnLoad@12instead of just plainAgent_OnLoad