Skip navigation

Write Portable Code: A Guide to Developing Software for Multiple Platforms



Write Portable Code: A Guide to Developing Software for Multiple Platforms

Every so often a computer book comes along with an interesting title that grabs the customer s attention enough to pick it up, thumb through it, and consider buying ... even when it s outside the normal boundaries of what that person might require immediately for their day job. Write Portable Code: A Guide to Developing Software for Multiple Platforms is just such a book.


Author Brian Hook, a former game developer for id Software and graphics card maker 3dfx, has refined his years of programming experience on numerous computing platforms, ranging from the Windows OS to the Sony PlayStation, and aggregated his expertise into this book. As such, the majority of the code in the book (freely available for download at is written in ANSI C or C++. A major header file advocated by Hook and referred to throughout the book is his self-authored cross-platform abstraction header file called the Portable Open Source Header (POSH). A separate appendix describes the header file s intent and operation. Hook also uses his own cross-platform audio library, called the Simple Audio Library (SAL), in several examples to highlight the span of portability considerations that need to be addressed when writing multi-platform code.


After introducing the basic tenants of portable code and the cross-platform ways to manage source control, the book dedicates a chapter to each of the major aspects of a modern multimedia computing environment. Processors, compilers, UI, networking, operating systems, file systems, and dynamic libraries are just some of the examples of the 18 chapters.


This is not a book about creating enterprise applications within virtual machines, such as the CLR or JVM. It s a book about writing C-level code that can be easily compiled and executed on multiple platforms with little to no change in the original source. As such, don t expect a dissertation on the joys of Java or the cool capabilities of C#. Rather, it s all about writing a high-performance application on a variety of hardware with a minimal amount of source code modification. Although this may not appeal to those developers who have already bought into the belief that code written in the 21st century must reside in and be protected by a virtual machine, the real world demands high performance on a variety of platforms.


Viewed from that perspective, the author does an adequate job of covering the landscape of considerations and concessions to be made, but the book lacks a full-blown application or case study demonstrating all the principles examined in the book. It was also void of a comparative analysis on the differences, advantages, and disadvantages of using the ANSI C approach versus Java or C# in high-performance situations. The only time the author introduces languages other than C/C++ is in his second to last chapter on scripting languages. Even with these omissions, the book is still an interesting read that can help any developer think outside the box and consider the time and architectural investment needed to write code beyond the bounds of a single OS.


Mike Riley



Title: Write Portable Code: A Guide to Developing Software for Multiple Platforms

Author: Brian Hook

Publisher: No Starch Press

ISBN: 1-59327-056-9

Web Site:

Price: US$34.95

Page Count: 272



Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.