For a long time, each C compiler provided a "standard" library, but we know all the "standard" C library just a joke, they are not so "standard" actually. Especially in cross-platform development, depend on the difference in compiler's design and the point of view, each compiler will add to or removed some behavious in the C library, just as type different : socklen_t defined in linux but windows not, SOCKET_ERROR defined in windows but linux not, even different headers with a same function, that lead us to have to increase expenditure : the sucking things below goes everywhere in our codes just take a compromise of them.
#ifdef LINUX ... #elif WIN32 ... #elif MACOX ... #endif
So i always search for a cross-platform base library seems like the "standard" C library, it must have some characteristic list below:
- It must base on the current compiler's C library.
- It must have the same types and the same api similar to the "standard" C library, and needn't to change you code when you using different compiler and in different operating system.
- It must compatible with the types and apis in C library. ( for example : you could use socket() to create a socket handle or do the same with compatible api compatible_socket(), you could operate the handle by send() or by compatible_send(), it should invoke without difficulty on local C library api or compatible apis. )
- All api's behavious predictable, execute situation the same on different compiler and operating system.
- It must dependence less except the C library from compilers.
May be someone will ask why not try the GLib?
The GLib is a good choice for C, and it's an excellent C utilities library, but it's not the thing i searching for. First, it implement all things independent of C library, though it could convert some basic C type to the types it using( just as FILE ), what's not my willing to do. Secondary, it toooooo GNU's, it must compile in the unix like environment with pkg-config ( ex : cygwin, msys, linux ... ), it depend on libintl, libiconv, etc ... third, in some cross-platform developments, the hardware and the environment decide it couldn't use so large a library ( you know, some compiler we have to use will compile all the library into the executable file, that greatly enlarge the last executable file size. ), and it seems so much dependences. May be it's also the reason why so much independent C package don't choice GLib as the base backend and implement their tiny compatible base layer ( ex : SDL, FreeImage, tinyxml ... ).
Actually, we need at last is : a library compatible to C standard library with similar apis ( removed all platform / compiler characteristic ).
I haven't seem there have something like this yet, may be it exist but i don't know.
After a long long time waitting, I decided to implement one for myself finally ...