| Issue 215: | Android shared object can only be loaded from Java | |
| 1 person starred this issue and may be notified of changes. | Back to list |
In the generated __main__.cpp when compiling an Android shared object there is only a function to load the SO from Java through JNI:
HX_BEGIN_MAIN
// TODO: main code here
HX_END_MAIN
However in many cases one would like to load the SO directly through the Android manifest with:
<meta-data android:name="android.app.lib_name" android:value="mySharedObject" />
This allows the developer to work fully 100% in C++ and not to have a Java layer. Hxcpp could support that by putting this or similar in the __main__.cpp as well:
**
* Main entry point.
*/
void android_main(struct android_app* state)
{
// Android specific : Dummy function that needs to be called to
// ensure that the native activity works properly behind the scenes.
app_dummy();
hx::Boot();
__boot_all();
// TODO: Custom code.
//
// Android specific : the process needs to exit to trigger
// cleanup of global and static resources (such as the game).
exit(0);
}
The Android application glue would then have to be used. It's also going to be optimal if __hxcpp_lib_main() IS ALWAYS included in __main__. __lib__.cpp is not really needed.
Dec 16, 2012
Project Member
#1
joshuagr...@gmail.com
Status:
Fixed
|