Some C++ namespace support for linux and OSX

https://d.puremagic.com/issues/show_bug.cgi?id=7961

Basics are working.

TODO: tests; Windows support