A lot of work toward a better portability. Removed fmemopen that has been
replaced by an internal module in C++.
Small fixes and added a dummy cpp file to trigger the use of a C++ compiler
for the linking of the tests.
Replace strndup with malloc() + strncpy, which seems to be more portable.