Cross Platform Development in C++ | Building Mac OS X, Linux and Windows Applications

Computer Programming and IT Books
Click Here To Download Book
Pages 575
Views 4160
Size 4.2 MB
Download 227
Table Of Contents


Areas That Can Affect Software Portability

The Role of Abstraction

1 Policy and Management

Item 1:Make All of Your Platforms a Priority

Item 2:Code from a Common Codebase

Platform Factory Implementations

Implementation Classes

Platform-Specific ProcessesImpl Classes

Creating the Instance Hierarchy

Organizing the Project in CVS or SVN

Makefiles and Building the Code

Item 3:Require Developers to Compile Their C

with Different Compilers

Item 4:Require Developers to Build Their Code

Multiple Platforms

Item 5:Test Builds on Each Supported Platform

Item 6:Pay Attention to Compiler Warnings

GNU Flags

Microsoft Visual C++

2 Build System/Toolchain

Item 7:Use Whatever Compiler Makes the Most Se

for a Platform

Item 8:Use Native IDEs When Appropriate

Item 9:Install and Use Cygwin on Windows

Item 10:Use a Cross-Platform Make System

Building on Windows


Installing on Mac OS X

Installing on Windows

Using Imake, an Example


Building a Complete Program from Multiple Sources

Overriding Defaults with site.def

Eliminating #ifdefs in Code

Files Used by Imake

Building Projects with Subdirectories

Building Debug

3 Software Configuration Management

Item 11:Use a Cross-Platform Bug Reporting

Tracking System


Ability to Track Platform-Specific Bugs


Item 12:Set Up a Tinderbox

Item 13: Use CVS or Subversion to Manage Source Code

Setting Up and Using CVS

Item 14:Use Patch

An Example

Patch Options

Dealing with Rejects

Patch and Cross-Platform Development

viii Conte

4 Installation and Deployment

Item 15: Provide Support for Native Installers


Platform Installs

5 Operating System Interfaces and Libraries

Item 16:Use Standards-Based APIs (For Example, POSIX)

Support for POSIX, SVID, XPG, and BSD

Using Standards Support in GCC

Microsoft Runtime Library Support for POSIX

Using GCC on Microsoft Windows

Deciding Which Standards to Support

Item 17:Consider Using a Platform Abstraction Libr

Such as NSPR


NSPR Basics

Additional NSPR Functionality

6 Miscellaneous Portability Topics

Item 18:Take Care When Using Floating Point

Don’t Serialize Floating-Point Values as Binary

Item 19:Be Explicit Regarding the Sign of Char Types

Item 20: Avoid the Serialization of Binary Data

Item 21:Avoid Problems Related to the Size

Organization of Types

Size of Integer Types

NSPR and Types

Sizes and Efficiency

Integer Conversions

Struct Alignment and Ordering

7 User Interfaces

Item 22:Separate the User Interface from the Model

Separating the User Interface and Application Lo

with Model/View


Using Publish/Subscribe to Communicate betw

the View and the Model

Item 23: Develop a Cross-Platform User Interface Strategy

Issues Affecting Portable Cross-Platform


Choosing a GUI Strategy

8 wxWidgets



Installing wxWidgets

A Simple Example: Hello wxWidgets

Creating the Application User Interface

Building wxWidgets Applications

Controls and Events

Container Widgets


Composite Widgets

Internationalization and Localization

9 Developing a Cross-Platform GUI Toolkit in C++

What is XUL?



Scripting Language

The Document Object Model

Style Systems


Windows and Dialogs





Other Widgets

Programming with XUL

Adding Logic to the UI with JavaScript

x Conte

Interfacing JavaScript and C/C++ Code with XP

and XPConnect


Widget Support in Trixul

Basic Operation of Trixul


Implementation Classes

Creating Widget Implementation Objects

Widget Factories

Application Main Loop

Steps Taken by Trixul to Create a User Interface

Documents, Elements, and the DOM

Widget Creation


Scrolled Windows and Layout

Integration with JavaScript

Integrating with C++ Components