I'm a Java developer by trade and my exposure to C++ / JNI has been limited until now.
I've managed to do pretty well so far but now that I'm venturing into doing "Clever" things I'm becoming more and more limited by flying blind:
I'm using the gnustl_static library because of other code which I've ported in the same native project space. However I'm finding it very difficult to learn C++ with one hand tied behind my back due to the cut down nature of the library.
It would all be fine is there was a Javadoc (Obviously not a Javadoc ;)) or some such documentation which I could use to find what was included inside this library and in turn, what was contained within those libraries (and while I'm wishing for the moon) why certain types such as "map" aren't included and what best to use instead!
From searching Google these past weeks I've not run across any centralised & useful resource and from everyone else's knowledge and expertise I feel like I'm missing a vital and basic resource!
Could someone please give me a hand and point me to Documentation or Tutorials or Examples or something which will help me navigate the dangerous waters of JNI / C++ / Native Android coding?
EDIT:
Someone has explained to me that STL is Standard Template Library and there is a link to what is contained within it here: http://www.sgi.com/tech/stl/stl_index.html
They have also explained that gnustl_static library is the STL library based on GNU machines and it is a set of headers located inside: ${ANDROID-NDK}\sources\cxx-stl\gnu-libstdc++\include
Suffice to say this has immeasurably helped me out since I had no idea what was going on. I just didn't know enough to know where to look.
I'm still slightly worried by the fact that STL doesn't seem to be owned by someone? (I'm thinking Apache style body here). Can anyone开发者_如何转开发 correct me on that?
As you can tell. Still a little adrift here.
EDIT2:
If the STL is the library used to describe all non primitive types and functions... why is string.h being pulled from: ${ANDROID-NDK}\platforms\android-9\arch-arm\usr\include
PS: I know I sound stupid here but I promise I'm just uninformed. I'm just not sure where to start looking as I feel through necessity I've started in the middle. Again, links to anything you think I would find useful would be great!
gnustl_static
is GNU stdlibc++ as it comes with gcc. It's official documentation is here, but it's probably useless as tutorial, so preferably get some decent book on C++.
The library does not appear to be cut down. It may look like that to you because standard C++ library defined in the specification is simply lot smaller than the one in Java. It has standard access to files, but no file manipulation, no threads, no network etc.
In android POSIX interface is generally available (plain C). If you want C++, try getting boost, which wraps the various system-specific interfaces in decent portable C++ components. However, many services on the Android platform won't be available except by going through the Java layer.
Ad Edit: Standard library specification is owned by somebody, namely ISO. Unfortunately the standard is not freely downloadable from ISO, but searching the web reveals this.
Ad Edit2: The C++ standard library is based on the underlying C standard library. The C++ standard library has the extension-less headers, while the standard C library has headers with suffix .h
. Both are defined by (different) ISO standards. The C library is most tied to the operating system (depends on specific method to make system calls), so it's provided with the system. On the other hand the C++ library is more tied to the compiler while it uses the C library to talk to the system, so it's provided with the compiler. That's why they live in different places.
精彩评论