Cross-Platform Development in C++ and over one million other books are available for Amazon Kindle. Learn more

Buy New

or
Sign in to turn on 1-Click ordering.
or
Amazon Prime Free Trial required. Sign up when you check out. Learn More
Buy Used
Used - Very Good See details
$6.99 & eligible for FREE Super Saver Shipping on orders over $25. Details

or
Sign in to turn on 1-Click ordering.
 
   
More Buying Choices
Have one to sell? Sell yours here
Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications
 
 
Start reading Cross-Platform Development in C++ on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications [Paperback]

Syd Logan (Author)
2.8 out of 5 stars  See all reviews (5 customer reviews)

List Price: $54.99
Price: $29.77 & this item ships for FREE with Super Saver Shipping. Details
You Save: $25.22 (46%)
  Special Offers Available
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Amazon.com. Gift-wrap available.
Only 11 left in stock--order soon (more on the way).
Want it delivered Monday, January 30? Choose One-Day Shipping at checkout. Details
Textbook Student FREE Two-Day Shipping for Students. Learn more

Formats

Amazon Price New from Used from
Kindle Edition $24.19  
Paperback $29.77  

Book Description

032124642X 978-0321246424 December 7, 2007 1

Cross-Platform Development in C++ is the definitive guide to developing portable C/C++ application code that will run natively on Windows, Macintosh, and Linux/Unix platforms without compromising functionality, usability, or quality.

 

Long-time Mozilla and Netscape developer Syd Logan systematically addresses all the technical and management challenges associated with software portability from planning and design through coding, testing, and deployment. Drawing on his extensive experience with cross-platform development, Logan thoroughly covers issues ranging from the use of native APIs to the latest strategies for portable GUI development. Along the way, he demonstrates how to achieve feature parity while avoiding the problems inherent to traditional cross-platform development approaches.

 

This book will be an indispensable resource for every software professional and technical manager who is building new cross-platform software, porting existing C/C++ software, or planning software that may someday require cross-platform support.

 

Build Cross-Platform Applications without Compromise

 

Throughout the book, Logan illuminates his techniques with realistic scenarios and extensive, downloadable code examples, including a complete cross-platform GUI toolkit based on Mozilla’s XUL that you can download, modify, and learn from. Coverage includes 

  • Policies and procedures used by Netscape, enabling them to ship Web browsers to millions of users on Windows, Mac OS, and Linux
  • Delivering functionality and interfaces that are consistent on all platforms
  • Understanding key similarities and differences among leading platform-specific GUI APIs, including Win32/.NET, Cocoa, and Gtk+
  • Determining when and when not to use native IDEs and how to limit their impact on portability
  • Leveraging standards-based APIs, including POSIX and STL
  • Avoiding hidden portability pitfalls associated with floating point, char types, data serialization, and types in C++
  • Utilizing platform abstraction libraries such as the Netscape Portable Runtime (NSPR)
  • Establishing an effective cross-platform bug reporting and tracking system
  • Creating builds for multiple platforms and detecting build failures across platforms when they occur
  • Understanding the native runtime environment and its impact on installation
  • Utilizing wxWidgets to create multi-platform GUI applications from a single code base
  • Thoroughly testing application portability
  • Understanding cross-platform GUI toolkit design with Trixul

Special Offers and Product Promotions

  • Buy $50 in qualifying physical textbooks, get $5 in Amazon MP3 Credit. Here's how (restrictions apply)

Frequently Bought Together

Customers buy this book with An Introduction to GCC: For the GNU Compilers GCC and G++ $14.56

Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications + An Introduction to GCC: For the GNU Compilers GCC and G++
Price For Both: $44.33

One of these items ships sooner than the other. Show details

  • This item: Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications

    In Stock.
    Ships from and sold by Amazon.com.
    This item ships for FREE with Super Saver Shipping. Details

  • An Introduction to GCC: For the GNU Compilers GCC and G++

    Usually ships within 2 to 3 weeks.
    Ships from and sold by Amazon.com.
    Eligible for FREE Super Saver Shipping on orders over $25. Details



Editorial Reviews

About the Author

Syd Logan is a software developer living and working in Southern California. A graduate of San Diego State University with B.S. and M.S. degrees in computer science, Syd was a member of the Netscape Client Product Development (CPD) team, where he held both engineering and management positions during the development of Netscape 6 and 7. After Netscape, Syd remained at AOL where he implemented VoIP and peer-to-peer video features as a member of the AOL Instant Messenger team. Syd’s previous publications include Developing Imaging Applications with XIELib and Gtk+ Programming in C (Prentice Hall, 1997 and 2001). His technical interests include machine learning, operating systems design, algorithms, and just about anything that has to do with C, C++, and Unix.

Excerpt. © Reprinted by permission. All rights reserved.

Preface

Cross-Platform Development in C++

Building Mac OS X, Linux, and Windows Applications

Syd Logan

Addison-Wesley

Preface

During the ten or so years of my career prior to joining Netscape in 1998, I had the good fortune to work on a wide variety of projects, on an equally diverse set of platforms. I worked on an embedded kernel of my own design for a somewhat obscure CPU (the TMS34020). I obtained experience in Windows kernel development, writing file systems drivers for the Windows NT and Windows 98 kernels, to support the development of a Network File System (NFS) client. In user space, I mostly specialized in user interface development, initially developing Motif (Z-Mail) and OpenWindows applications for UNIX, eventually getting exposure to Win32 and the Microsoft Foundation Classes (MFC) toolkit on the Windows platform. I even had the chance to write code for the Classic Mac OS to support a project that would be shipped by Apple, using the Mac Toolbox application programming interface (API). All of this code was written in the C language, and all of it was highly nonportable, written only with a concern for the job, and platform, at hand.

But then I joined Netscape, as a UNIX expert of sorts. Initially, I was assigned the task of working on bugs in the 4.x Netscape browser, specifically handling defects filed against a port of the browser to IBM's Advanced Interactive eXecutive (AIX) platform. Netscape had a contract with IBM to ensure that bugs filed against the AIX version of the Netscape browser, or bugs that IBM considered important, were fixed in a timely fashion, and this contract funded my hiring. Similar deals were cut with SGI, Hewlett-Packard, and Sun, and perhaps others, and these deals funded additional Netscape staff. Two or three of us were assigned to deal with AIX, specifically.

During this time, portability had not yet been perfected at Netscape. Although much of the codebase of Netscape was portable, the project did not have a unified build system, and the user interface code was completely platform specific. Many bugs had a decidedly platform-specific nature to them (hence the need to have separate teams to support individual platforms). Code that worked flawlessly on the Windows version of Netscape ran horribly on less well-supported platforms. Not all platforms had the same set of features, and features varied from platform to platform.

Within a year of joining Netscape and fixing AIX bugs, I somehow earned my way onto the Netscape Instant Messenger team, and work on the new codebase based on the open source Mozilla platform. This team, which consisted of three engineers, was tasked with porting the AOL Instant Messenger client to the Netscape browser. The Netscape IM team was hastily formed right after AOL acquired Netscape, to try to bring AOL-based functionality into the application. (The other major AOL property integrated into Netscape was support for AOL Mail).

The new Netscape client, in development at that time, was, as mentioned previously, based on the open source codebase named Mozilla. This codebase, at the time, was largely the product of Netscape engineers located in offices located in San Diego, and Mountain View, but contributions from the open source community were on the rise. (I refer to the project as Netscape/Mozilla in the remainder of this Preface).

Netscape was in fierce competition with Microsoft for the browser market at this time, which meant the browser of course had to work well, and ship on time on the Windows platform. Netscape also generated significant advertising revenue through the Netscape portal, and clicks there were highest when a new version of the browser was released, and tens of millions of users visited the portal to download a fresh copy of Netscape. Supporting Netscape not only on Windows but also on Mac OS and Linux helped keep the number of visits high and generate revenue. So, Linux and Mac OS were treated as equals with Windows within the Netscape culture, not only because it was the morally right thing to do (as many of us believed), but also because every visit to the Netscape portal was important to the bottom line of the company.

Netscape/Mozilla was a complete departure from anything that I had ever seen or worked on before. First of all, this new version of Netscape was not just a browser, it was a platform, capable of hosting applications. (The primary examples shipped with Netscape were AIM, the Mail/News client, a WYSIWYG HTML editor named Composer, the Chatzilla IRC client, and the browser itself. Extensions, such as those available for Firefox today, are closely related). Instead of building the graphical user interface (GUI) for these applications in C or C++, using APIs provided by a native platform GUI toolkit such as MFC or Gtk+, Netscape/Mozilla-developed technologies were used instead. Static Extensible Markup Language (XML) files were used to describe the layout of the user interface, much like HTML is used to describe the layout of a Web page. The XML dialect developed for this purpose was called XML User Interface Language (XUL). JavaScript code, linked to the XML elements via attributes much like JavaScript is linked to HTML elements in a Web page, was used to respond to menu item selections and button clicks. To build an application for Netscape/Mozilla, all one needed was this combination of XML and JavaScript; and because both JavaScript and XML are intrinsically portable, so were the user interfaces that were designed using these technologies. When JavaScript wasn't enough to do the job (as was the case for any real applications, like those shipped with Netscape and Mozilla), JavaScript code could call C++ functions that provided the guts of the application, housed in shared libraries. These shared libraries, or components, were directly supported in the Netscape/Mozilla architecture via two technologies: XPConnect and XPCOM. These technologies allowed component developers to define platform-agnostic interfaces using an Interface Description Language (IDL). Using XPCOM and XPConnect, JavaScript code could query for the existence of a component, and from there, query for a specific interface. If all was good, the JavaScript code was handed an object that it could call just like any other object, except the object was written in C++, and was capable of doing things that JavaScript programmers could only dream of. The interfaces, by their nature, were highly platform agnostic.

The impact of the work done to support portability in the Netscape/Mozilla architecture was not, quite frankly, immediately apparent to me. But, over time, I came to appreciate the power of such an approach. The positive effects of the decisions of those who came up with the architecture are indisputable; during its heyday, Netscape was shipping tens of millions of browsers to users, not just for Windows, Mac, and Linux, but for SunOS, AIX, HP-UX, SGI Irix, and a host of other UNIX-based platforms. The "tier-1" platforms (Mac OS, Linux, and Windows) literally shipped at the same time. Each of these ports had, for the most part, the same feature set, and mostly shared the same set of bugs and quirks. To achieve portability at such a grand scale required a very special architecture, and it is one of the goals of this book to give you a good understanding (if not an appreciation) for how the Netscape/Mozilla architecture directly impacted the portability of the codebase.

However, it was not just the architecture of Netscape/Mozilla that made the browser and related applications (AIM, Mail, Composer) portable. To pull this sort of thing off, one needs not only a solid architecture, but also a culture of policies and procedures that put cross-platform development high on their lists of priorities—as well as large doses of discipline to ensure these best practices were followed. Tools, such as Tinderbox and Bugzilla, both which are described in this book, were invested in heavily by Netscape and Mozilla, and the investment paid off in spades. Engineers were forced to consider other platforms, not just their own, and a regression found during daily testing on just one platform could halt development on all platforms, not just the one affected, because Netscape and Mozilla realized that the only true way to achieve portability was to deal with the issues in the here and now. A good chunk of this book steps away from the code, and describes these best practices, because no matter how good your architecture is in supporting cross-platform, you have to work all the platforms you plan to support with the level of care and devotion to detail if they are going to make it to the finish line with the same levels of quality.

Similar to the way that the programs we write are made up of data structures and algorithms, portability, in my opinion, consists largely of architecture and process, and this conviction is at the foundation of the book that you now hold in your hands.

How This Book Is Organized

This book is organized as a series of themed chapters. Most of these chapters consist of a set of items, with each item covering a specific topic supporting the chapter's overall theme. Early in the book, you will find sections that contain items presenting best practices that must be communicated to the entire development organization, including management, development, and testing. Later chapters cover software-engineering topics that management should be aware of, but these chapters have been written primarily for readers who will be implementing the code. In all, there are 23 items presented in these initial chapters.

The implementation of a user interface is a major concern in the development of cross-platform desktop applications. Item 23 serves to introduce the topic. The final two chapters of the book are therefore devoted to cross-platform GUI-related topics. The first of these chapters provides a comprehensive introduction and tutorial to the wxWidgets cross-platform GUI toolkit. After reading my intr...


Product Details

  • Paperback: 576 pages
  • Publisher: Addison-Wesley Professional; 1 edition (December 7, 2007)
  • Language: English
  • ISBN-10: 032124642X
  • ISBN-13: 978-0321246424
  • Product Dimensions: 7 x 1.1 x 9.2 inches
  • Shipping Weight: 1.8 pounds (View shipping rates and policies)
  • Average Customer Review: 2.8 out of 5 stars  See all reviews (5 customer reviews)
  • Amazon Best Sellers Rank: #939,020 in Books (See Top 100 in Books)

More About the Author

Discover books, learn about writers, read author blogs, and more.

 

Customer Reviews

5 Reviews
5 star:    (0)
4 star:
 (3)
3 star:    (0)
2 star:    (0)
1 star:
 (2)
 
 
 
 
 
Average Customer Review
2.8 out of 5 stars (5 customer reviews)
 
 
 
 
Share your thoughts with other customers:
Most Helpful Customer Reviews

7 of 8 people found the following review helpful:
4.0 out of 5 stars Good book, April 20, 2008
Amazon Verified Purchase(What's this?)
This review is from: Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications (Paperback)
To be honest this one of the few technical computer books I've read from cover to cover. I usually just use them for reference. On the subject of cross platform development this is currently the best and most up-to-date however there were a few areas I would have liked to seen covered better most notably the build environment and makes. Mr Logan does touch on these subjects but they are not given as much focus as I would have like to have seen which is why I'm taking one star away. With that said if I was asked to recommend a book on cross-platform development it would be Syd Logan's, hands down..
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


11 of 17 people found the following review helpful:
4.0 out of 5 stars reduce porting bugs, December 21, 2007
This review is from: Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications (Paperback)
Logan tackles a lot of grubby little complications that are the bane and reality of programmers writing multiplatform C++. This is not a book about learning C++ from scratch. Conceptually, it helps to think of this book as about 1 level above writing C++ code. For example, it discusses compiling, linking and running, where needed libraries might be missing.

The book describes 3 platforms. Microsoft Windows, Macintosh and unix/linux. Strictly, the Macintosh is nowadays using a unix variant. But it's done differently enough, and the Mac is popular enough, that Logan stands it separate from other unix/linux environments.

Perhaps the best recommendation of the book is to use a platform abstraction library. So that you can far more easily maintain a common code base. The suggested choice of library is NSPR. One simple way that it helps is in how it makes explicit the byte lengths of various C/C++ variables. This legacy C ambiguity is still with us, and causes much porting pain. It is no accident that newer languages like Java and C# make these definitions explicit. But many of us still have to write in C and C++.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


2 of 4 people found the following review helpful:
4.0 out of 5 stars Good start to solid C++ portability, May 13, 2009
This review is from: Cross-Platform Development in C++: Building Mac OS X, Linux, and Windows Applications (Paperback)
This was a good book to reference and augment your C++ portability skills. I have been porting code for years and found a few nuggets in this book I did not have to find out through trial by fire.

As a previous reviewer mentioned, it does not cover Java or C#/Mono, which by the name of the title makes sense. Java and C#/Mono are good tools, but if you need to be where the metal meets the meat and need the squeeze out all your MIPS you can, you'll have to move down the language hierarchy to C++ and assembly.

By setting up a nice abstract layer and firewalling you system calls and platform dependencies, you can usually build quite large sustainable C++ cross platform frameworks on many systems without the need for a VM level language.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No

Share your thoughts with other customers: Create your own review
 
 
 
Most Recent Customer Reviews



Only search this product's reviews



Inside This Book (learn more)
Key Phrases - Statistically Improbable Phrases (SIPs): (learn more)
user interface language, standard template library, static text widget, mozilla script, box sizer, native toolkits, source code management system, root admin, build buddy, ement object, patch file, code reviewer, thread proc, container widgets, int pid, installer executable, browser suite, unused parameter, scrolled list, static text field, installer script, widget class, application bundle, smoke testing, modeless dialog
Key Phrases - Capitalized Phrases (CAPs): (learn more)
Hello World, Build System, Cross-Platform Make System, Visual Studio, Consider Using, Platform Abstraction Library Such, Common Codebase, Microsoft Corporation, Program Maintenance Utility, Red Hat, Standard Library, Microsoft Windows, Miscellaneous Portability Topics, User Interfaces, Use Standards-Based, Microsoft Visual, Separate the User Interface, Caesar Cipher, Weather Manager, Software Configuration Management, Preferred Customer, Program Files, Fedora Core, Require Developers, Avoid the Serialization of Binary Data
Browse Sample Pages:
Front Cover | Table of Contents | First Pages | Index | Back Cover | Surprise Me!
Search Inside This Book:


Tags Customers Associate with This Product

 (What's this?)
Click on a tag to find related items, discussions, and people.
 
(1)
(1)

Your tags: Add your first tag
 

Customer Discussions

This product's forum
Discussion Replies Latest Post
Cross-Platform Development in C++ Discussion Thread 0 Mar 22, 2008
See all discussions...  
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Active discussions in related forums
Search Customer Discussions
   
Related forums





Look for Similar Items by Category


Look for Similar Items by Subject