Porting C++ application to Android using NDK - c++

I want to port an C++ application to Android using the NDK. The application is to be used in both Win-PCs and tablets (Project Tango). Its function is to support a custom API that I am testing. The applications are for research purposes only, so I am not worried about deployment other than on said tablets.
I know that the NDK support of C++ libs has evolved substantially since this question: Porting a C++ application to android
The application I am porting depends on the following headers:
STL containers, pthreads32, jsoncpp, winsocks.
I know winsocks will have to be rewritten to BSD sockets, what about STLs and pthreads? Will jsoncpp work if I have the complete library?
Also, what is the process for including other libraries? Do I just include the .so file? Apologies, I am very new to the NDK.

STL support is documented here: https://developer.android.com/ndk/guides/cpp-support.html
Can include prebuilt libraries into your app with https://developer.android.com/ndk/guides/prebuilts.html

Related

Does ADAPTIVE Communication Environment (ACE) C++ library has support for iOS and Android?

I have been searching for cross platform C++ networking libraries with SSL and authentication support and came across ADAPTIVE Communication Environment (ACE) C++ library.
However, searching through its website ( http://www.dre.vanderbilt.edu/~schmidt/ACE.html and http://www.dre.vanderbilt.edu/~schmidt/ACE-versions-i.html), i can't find android mentioned anywhere.
Is this library supported on Android along with MacOS, Windows and Linux? I have also come across boost ASIO and POCO but wanted to consider ACE as well if the platform support is there for my requirement.
ACE supports Android and iOS, see the ACE-INSTALL.html for some documentation.

c++ gui window cross platform

I would like to make c++ that will work both on Linux and windows as I understand if I use the win32 template in visual studio then it will only work on windows is there something built into c++ like java's jframe that I can use. Also I would like to use any external library at this time.
Here are some cross platform alternatives QT, wxWidgets, Ultimate++. I have used QT, it is intuitive with a huge collection of tools to use in your code. The others are also popular but I have never used them.
I make used of wxWidgets due to it's cross platform and even cross architecture, native look on the OS where it appear. Binary application yields by wxWidgets is small enough thus make it possible to linking statically as portable application. Qt produce huge binary if linked statically (and may be violate qt licensing scheme).
Another reason are licensing flexibly, well documentation and supported by huge community arround the world. wx is considered as mature framework since it first release about 20yrs ago. It's use standard C++ syntax and preprocessor that will make you easily switch from plain C or C++. Complete library are available ranging from appeal window GUI, string, network, stream, webview, xml, and wx is playing very well with 3rd party library as such database SOCI, Asio, etc ....
You may try start to code with wxWidgets easily using Eclipse-IDE and wxFormBuilder as GUI designer. Plese check my experience for ease setup it's IDE+Toolchain. This wx installer can be used do develop, test and run wx application on Linux desktop, and then deploy the binary on Raspberry Pi is available for another board target beside Linux x86_64.
http://yasriady.blogspot.co.id/2016/01/raspberry-pi-toolchain.html
There is a cross-platform application & UI development framework called Qt. I think it meets your requirements. Click here for more info.
There is a long list of both active and dead cross-platform C++ UI libraries here: https://philippegroarke.com/posts/2018/c++_ui_solutions/

REST client in C++

Has anybody successfully tried any C++ REST library (client) in their enterprise product? It can be collection of software stack, but it should have the capability to run on all platforms, i.e.: Windows, Linux, Solaris, AIX, HP-UX.
You may want to check thin REST client for C++ at https://github.com/mrtazz/restclient-cpp.
It is a C++ wrapper around good and stable multiprotocol, multiplatform libcurl library.
C++ REST SDK is an actively developed C++ REST client that is currently supported in Windows, Mac OS X, iOS and Android. It is also licensed under Apache License 2.0 which opens up a range of customizations on the library to suit your needs.
Here is the list for most useful C++ libraries include network library:
https://en.cppreference.com/w/cpp/links/libs
you can see listed can be used as REST client library:
Boost.Beast
C++ REST SDK
curlpp
I cannot recommend any integrated solution but what you can do is use:
Transport: neon, serf or libcurl (all of them have advs and disadvs)
XML parsing: libexpat or libxml2
JSON parsing: Jansson or JSON Spirit

Does this networking library work on iOS?

I want to use this library for cross platform networking.
http://lacewing-project.org/
It works with OSX, Linux, Windows and has specific code for Android. What I do not know is if it will work (as a client) on iOS. (meaning I will not host a server on iOS)
Since it uses POSIX sockets internally does that make it compatible with iOS?
Thanks
Without trying it, my guess would be that it would work. You will need to write your UI in Objective-C, but you should be able to use Objective-C++ to bind your libraries to the UI. Before you start into the Objective-C++ path be aware of the limitations (see: How well is Objective-C++ supported?).
I would try using the objective-c library AFNetworking first, from the creators of gowalla.
You can get it here:
https://github.com/AFNetworking/AFNetworking
On the topic of lacewing, it should work fine, as long as it relies upon the BSD sockets API, as I can confirm that it exists on iOS.
If it's only written in C/C++ then no, unless you got a C/C++ SDK for iOS (which AFAIK does not exist publicly). iOS SDK is for Objective-C.

How to run run C++ apps in android?

How to run c++ applications in android using cygwin. Any tutorial in this regard is appreciated..
You cannot directly run C++ applications in Android.
Android can run only applications written using the Android SDK, but yes you can re-use your native(C/C++) libraries for Android.
You will have to recompile all the native libraries specifically for Android. And you do need the source code for all 3rd party native libs you plan to use simply because Usually when we compile and link these libraries outside Android they are linked to glibc but unfortunately Android doesn't use glibc due to liscence and performance issues. Android uses a watered down version of glibc called libc. It has matching symbol names to glibc for most of the usual functionalities. But as far as i know the libc doesn't have some functionality related to Strings and it definitely doesnt have some posix support. If your native libraries are using any of the deprecated functionality you will have to find workaround for those by using alternative functionality supported by libc and coding your libs accordingly.
Also, you will have to use the NDK to interface Java(Android app/fwk) to native world(C++). And then write a Android application on top of that.
Though this sounds pretty simple in my experience compiling native libraries on Android(Android porting) has traditionally been very time consuming with no guarantee of sucesses.
You will want the Java Native Interface, or "JNI".
See: "Java Native Interface Wiki" "Android JNI Tips" and links therein. It is some work to get this going and to get used to how it goes. I managed it from the references given here with C and it will work out after some time and faith without further help if you follow all the steps.