Actually, "this platform independent lib you are looking for is called" the Java API.
Lately, it's increasingly being made available for languages besides the Java language. And, yes, native C++ is one of them. The core Java APIs (java::lang, java::io, java::util) can be used directly from C++ without requiring a JRE or VM for development or deployment.
NewJ for C++: Java API for Native C++
Positives: The library is small in size and light in resource usage. Objects are managed deterministically much like C++ smart pointers and not at the whim of the GC, which may be very important for embedded systems. Applications can be deployed as a single
Negatives: Presently, java::net API classes are a work in progress, and there's no Linux version. Presently, it's only for Win32 and Windows Mobile.
NewJ: FAQ
Instead, we developed our own automated object management facility based on reference objects, that is, "smart pointer" objects with these new capabilities: Reference objects in C++ are completely synonymous with object references in Java. Unlike traditional smart pointers, reference objects support inheritance, both single-implementation inheritance and multiple-interface inheritance. These inheritance characteristics also apply to reference objects of arrays. They can also be built to be rigorously threadsafe and secure.
Reference objects have allowed us to port Java source code directly to C++ with virtually no changes. They have also allowed us to take advantage of productive Java language features in new C++ projects without the overhead or installation of any JRE or VM. delete has disappeared from our C++ code entirely. At the same time, our C++ is still characteristically lean and interoperates naturally with other C/C++ libraries and APIs, such as ANSI C++ STL, Win32 API, and MFC.
We have used these concepts to implement the core Java API in C++, for C++, although reference objects themselves are not specific to this API. They are implemented in our low-level Pie Library and usable in any C++ application.
Info and features of NewJ and Pie Library
The NewJ C++ Developer's Guide explains reference objects more fully. It is available as a free download (registration required).
Logic is the chastity belt of the mind!