This question is in continuation to Should I choose Boost Asio or Aysnc Socket threads in Android? asked,
Boost libraries are intended to be widely useful, and usable across a broad range of applications, but yet there is no official support available for Android and iOS
FYI..I have been using following links to create a sample Android application , but not successful yet :(
https://github.com/MysticTreeGames/Boost-for-Android
http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/
Include Boost C++ library in android
How to use the boost library (including shared_ptr) with the Android NDK and STLport
https://sites.google.com/site/fourdollars/android/android-mk
https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/4lxhsKFe7Ho
http://www.crystax.net/trac/ndk/ticket/6
Android NDK R5 and support of C++ exception
Thanks in advance.
Boost works perfectly on Android.
Got reply from boost community Yes. These platforms are not officially supported because no one has volunteered to run regression tests regularly for them.
It is not possible for a Boost developer to test on all platforms. So developers depend on the test results of regression tests run by volunteers. For example, see http://beta.boost.org/development/tests/trunk/developer/summary.html
If no one volunteers to run the tests for a particular platform, that platform is not officially supported.
So if you care about Android or iOS becoming officially supported, start running regular (preferably daily) regression tests for Boost. See http://beta.boost.org/development/running_regression_tests.html
Check out my cross-platform-tutorial on github. It shows you how to set up Boost and use it between iOS and Android. I had such a horrible time with this, I figure I'd document it so no one else had to figure it out. You'll notice that this project also pulls in several other common items used between the two platforms, e.g., CoreFoundation and SQLite.
https://github.com/markshiz/cross-platform-tutorial
Note: My tutorial does not show how to build the compiled libraries for boost. I have done that before with success using the instructions you provided:
http://www.codexperiments.com/android/2011/05/tips-tricks-building-boost-with-ndk-r5/
After you have a static library compiled by the Android toolchain, you can easily link it in via a module similar to those under the include/[NAME OF NEW SUBMODULE]
directory of the project above. Use something similar to the following for the Android.mk
file in the root of that directory.
include $(CLEAR_VARS) LOCAL_MODULE:= boost_regex LOCAL_SRC_FILES:= ./path/to/built/static/library/libboost_regex-gcc-mt-s.a LOCAL_EXPORT_C_INCLUDES := ./path/to/the/directory/that/has/the/boost/headers include $(PREBUILT_STATIC_LIBRARY)
Finally, import that module, as in the example, inside
$(call import-module,[NAME OF NEW SUBMODULE])
As far your other questions --do you know of an application that uses Boost on iOS and Android? Yes, I have done it multiple times with success and released working apps to the App Stores.
Your other question, is it advisable to use boost for network communication? I'm not sure what you mean here. From what angle? Do you mean, philosophically, technically, etc?
Philosophically, you have to ask yourself, what is your reasoning for importing this library and using it between Android and iOS. Is it to save code time, maintenance burden. If so, I'd say this is an excellent way to do that. Clearly there are some hurdles and pain to get this sort of a set up working. Also, the IDE features for C++ aren't as awesome as for Java in Eclipse. I try to be fair and balanced in the PDF presentation in the doc/
directory. Give that a once over.
From a technical perspective, I think the only thing I would be worried about is making sure I clean up the Asio objects properly when the Activity is stopped. If you need to do things in the background, use a Service instead:
http://developer.android.com/reference/android/app/Service.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With