WVR_RegisterMain¶
- typedef int (* WVR_Main_t)(int argc, char *argv[])
It is the entry function pointer of the native application.
The pointer of the entry function is set to associate with the runtime library.
- extern WVR_EXPORT void WVR_RegisterMain(WVR_Main_t main)
It is the interface to register the main function.
When VM needs to load native library and call JNI_Onload, runtime expects that the entry function of the native application will register here via this API.
Parameters
- main -
WVR_Main_t, the entry function pointer of native application.
How to use¶
Here is an example for the function:
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
new Context(vm);
LOGI("register main when library loading");
WVR_RegisterMain(main);
return JNI_VERSION_1_6;
}