Jump to content

Do I have to register the main function?


xulzee

Recommended Posts

    I am  a newer in vive focus development. The function I want to implement is very simple. Can I not register the main function? I want to wrap the function in the jni layer and And call them in java.

    Is there any problem with this?  Thank you very much for your generous help.


 

Link to comment
Share on other sites

So if you want to do that (i.e. have a C main function entry), it has to be in a dynamically loaded library and you'll have to do the following in "native" Java Android:

 

static { System.loadLibrary("mylib");}

 

and write a JNI call to call it:

 

JNIEXPORT return_type JNICALL Java_full_package_name_classname_functionname(JNIEnv *env, jobject object, Jobject stringArray) {
  // convert to C Strings here
  main(argc, argv);
  // clean up here
}

 

But if you're new to this, please reconsider and try native Java instead or better yet use Unity or Unreal instead.

 

 

 

 

 

Link to comment
Share on other sites

Thank you very much for your generous answer.

Maybe I didn't know what I said before. The function I want to implement is very simple (similar to rendering a real-time video stream into the vive focus), so I started to learn wave native sdk. In the examples I saw, I needed to use WVR_RegisterMain( Main) This function is used as the entry point for the entire application,

 

so my question is: Can I implement the specific operation in the native layer (call the SDK), write the logic flow in the java layer, that is, do not call the WVR_RegisterMain function.

 

But then again, to achieve my function is not to use unity is simpler.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...