Jump to content
Happy Holidays! Limited Staff Responses: 1/20 - 1/31 ×

Do I have to register the main function?


xulzee
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...