COCOS2DX implementation of CPP partial online update under Android

Source: Internet
Author: User

Currently COCOS2DX + LUA can dynamically update all of the script files, but cannot dynamically update the CPP part of the code (which is what we call the bottom package), in fact, the same scheme can be implemented in Android dynamic update, Just add a little bit of code to the Java code to load libgame.so.
static {System.loadlibrary ("game"); To move the above code to OnCreate, you might see the following
protected void OnCreate (Bundle savedinstancestate) {File File = new file (Getfilesdir (). GetAbsolutePath ()     + "/libgame.so");     if (file.exists ()) {System.load (File.getabsolutepath ());     } else {system.loadlibrary ("game"); } super.oncreate (savedinstancestate);}
This way we can update the libgame.so into a writable directory just like the Lua script, and then load the new libgame.so, and there may be some modifications to make sure that the current program does not crash when the libgame.so is modified.
Probably researched, iOS can create a dynamic link library, technically allowed, but the audit app will be rejected, do not allow this way to use, so it may not be able to implement on iOS, such as the dynamic update on Android, but you can think of the broad sense there is no other way, If you have any plan, please share it, thanks a bit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.