This post has already been published on code::gallery blog which now has been merged into this blog.
Developing cross-platform C/C++ code is not difficult, but definitely challenging and has to be disciplined. Usually, a separate interface is designed so that the platform-specific code is encapsulated. The challenges are presented on multiple fronts - every platform (OS and/or CPU architecture) has its own API for system operations, its own Endianness, implementation of pointers and more.
Today, developers have access to a plethora of cross-platform abstraction libraries. What this means is that the developers don’t have to worry about differences in the platforms and focus on their applications. The differences are abstracted into the libraries/toolkits/frameworks. Shlomi Fish has a nice extensive list including the popular Standard Template Library (STL).
Out of these, I have worked with Posix Threads for Win32, Boost and Mozilla XUL.
In addition to this Mozilla has a Cross Platform Component Object Model (XPCOM), which is the underlying base for every Mozilla application. I have also used Xerces C++ Parser. In addition to this, Ch language environment, an embeddable interpreter for cross-platform C/C++ scripting, is available for developing XML-based applications using C/C++..
Andrei Alexandrescu has developed a cross-platform library, called Loki (through his book Modern C++ Design), for illustrating benefits of policy-based programming. It employs template metaprogramming to the fullest.
Then there are Blitz++ and Matrix Template Library (MTL) (via O’Reilly Network).
As mentioned earlier, the code development should be disciplined to ensure portability. Mozilla has a C++ portability guide for making code portable.
I am sure all the libraries are not included here, if you know any that are not mentioned here, feel free to add them in the comments. I will update the post accordingly.
Copyright Abhijit Nadgouda.


October 27th, 2007 at 9:32 am
[...] C++ code after I have understood the purpose of interface. I understand C++ itself, and many of its libraries much better, which I still like. And I will not hesitate to say that it has had an impact on me [...]
November 22nd, 2008 at 11:37 pm
Hi Abhijit!
Thanks for linking to my page about the topic. However, it would be preferable if you linked “Shlomi Fish” to my homepage or to a more representative page, and “extensive list” to the list itself. But it’s a nice post, and I may draw inspiration from it.
I also subscribed to your blog using my RSS reader.
Regards,
– Shlomi Fish
November 22nd, 2008 at 11:38 pm
Duplicate comment yada yada yada
Hi Abhijit!
Thanks for linking to my page about the topic. However, it would be preferable if you linked “Shlomi Fish” to my homepage or to a more representative page, and “extensive list” to the list itself. But it’s a nice post, and I may draw inspiration from it.
I also subscribed to your blog using my RSS reader.
Regards,
– Shlomi Fish
November 22nd, 2008 at 11:39 pm
Hi!
Your blog ate two of my comments - please restore them. WordPress is a PoS.
November 25th, 2008 at 4:53 pm
Shlomi, links fixed. The comments were added properly, but caching did not show them immediately. Need to look into it. Thanks!