Write Portable Code

An Introduction to Developing Software for Multiple Platforms
by Brian Hook

July 2005, 272 pp.
ISBN: 978-1-59327-056-8
Contents | Reviews | Updates

View a sample chapter, Chapter 5: Processor Differences
Download the Poshlib code
Download the Sal code

Portable software development is the task of writing software for not just one computer system (e.g. Windows), but for a broad range of computer systems. Write Portable Code contains the lessons, patterns, and knowledge for developing cross-platform software that programmers usually must acquire through sheer trial and error. This book is targeted at intermediate- to advanced-level programmers and will be a valuable resource for designers of cross-platform software, programmers looking to extend their skills to additional platforms, and programmers faced with the tricky task of moving code from one platform to another.

Visit the Write Portable Code website for more information, downloads, and errata.

About the Author

Brian Hook is a professional software developer and author who has worked primarily in the gaming and entertainment industries. His experience developing cross-platform software at companies such as id software, 3Dfx Interactive, and Pyrogon gives him a unique view into the process of cross-platform software development.

Table of Contents


Chapter 1: Preparing for Portability
Chapter 2: ANSI C/C++
Chapter 3: Techniques for Portability
Chapter 4: Editing and Source Control
Chapter 5: Processor Differences
Chapter 6: Floating Point
Chapter 7: Preprocessor
Chapter 8: Compiler Quirks
Chapter 9: User Interaction
Chapter 10: Networking
Chapter 11: Operating Systems
Chapter 12: Dynamic Libraries
Chapter 13: Security and Permissions
Chapter 14: File Systems
Chapter 15: Scalability and Portability
Chapter 16: Portability and Data
Chapter 17: Internationalization and Localization
Chapter 18: Scripting Languages
Chapter 19: Cross-platform Libraries and Toolkits

Appendix A: POSH
Appendix B: The Simple Audio Library
Appendix C: The Rules for Portability



Book description blurb
Book News, March 2006 (Read more)

“People interested in portability issues will find this a great resource.”
Edmonton Linux Users Group, December 2005 (Read more)

"Even if you are not a C/C++ programmer, but portability interests you, this book is a good read... [Hook] really gets into the details."
UNIX Review, January 2006 (Read more)

"What makes this book worth owning is the breadth of its coverage, and the way the author ties various solutions together."
Pyre Blog, December 8, 2005 (Read more)

"The author's knowledge and experience shines through, as does his writing skill."
Reg Developer UK, December 4, 2005 (Read more)

"Hook was clever enough and so well focused, that he wrote precisely the right amount to cover everything he needed to, without rambling."
Free Software Magazine, December 15, 2005 (Read more)

“I like this book - it had all the ‘gotchas’ I knew about and added
several more.”
Edmonton Linux Users Group, December 2005 (Read more)

Included in roundup of infosec and related books: "Buy a copy for any developers you know tasked with such projects. They will likely thank you!"
Security.ITWorld.com, December 2, 2005 (Read more)

Included in New & Noteworthy section: "As a veteran of the platform-fragmented game and entertainment industries, Hook learned the art of designing up-front for portability. You can learn from his experience through both the text and the source of the libraries he provides."
Software Development, December 2005 (Read more)

Interview with author Brian Hook
Techbook.info, November 20, 2005 (Read more)

Link to Slashdot review
Hacklog, November 9, 2005 (Read more)

"A very well written and very readable book. There are many aspects to portability and Hook addresses more of them than many of us had previously suspected existed and addresses them with firm authority."
Slashdot, November 9, 2005 (Read more)

Selected as one of Jerry Pournelle’s "Computer Books of the Month": "Experienced C users advise me that I will not go wrong by recommending this book."
Byte, October 2005 (Read more)

"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."
Asp.netPRO, October 2005 (Read more)

"Highly practical and very useful... A big plus for the book is the sample application, SAL (Simple Audio Library), which puts into practice the principles that are discussed throughout the book."
TechBookReport.com, (Read more)

5/5 stars: "Are you into mining for programming gold? Take a look here to see if you can think about more than one platform at a time from a non-Java approach."
MacCompanion, September 2005 (Read more)

"Write Portable Code is packed with specifics which lend to both an overall understanding of concepts and the ability to troubleshoot common problems."
Midwest Book Review Internet Bookwatch, September 2005
(Read more)

Book info posted
LinuxGames.com, August 22, 2005
(Read more)

“This sample chapter examines the issues you'll run into when moving code between processor architectures.”
Tech Republic, August 4, 2005
(Read more)

Book announced
Book News UK, August 2005
(Read more)

“A really good investment in your survival...”
Duffbert’s Random Musings, July 25, 2005
(Read more)

“Within the first few chapters, I’ve already learned about a new tool.”
GBGames’ Blog, July 21, 2005
(Read more)