Skip to Main Content
Palm OS Programming, 2nd Edition
book

Palm OS Programming, 2nd Edition

by Julie McKeehan, Neil Rhodes
October 2001
Intermediate to advanced content levelIntermediate to advanced
704 pages
19h 33m
English
O'Reilly Media, Inc.
Content preview from Palm OS Programming, 2nd Edition

Portability Issues

There are two important portability issues to take into account when moving data back and forth from the handheld to the desktop: byte ordering and structure packing.

Byte Ordering

The Palm OS currently runs on a Motorola platform, which stores bytes differently from Windows running on an Intel platform. This crucial difference can mess up data transfers royally if you are not careful.

Tip

It’s been announced that a future version of the OS will run on the ARM processor in little-endian mode (which will match the Intel ordering). Right now, it’s not clear what the implication will be for conduits. To be safe, use the Sync Manager routines for swapping rather than writing your own.

On the handheld, the 16-bit number 0x0102 is stored with the high byte, 0x01, first, and the low byte, 0x02, second. In the conduit on Windows, the same number is stored with the low byte, 0x02, first, and the high byte, 0x01, second. As a result, any 2-byte values stored in your records or in your AppInfo block must be swapped when transferred between the two systems. (If you fail to swap, a simple request for 3 boxes of toys on the handheld would be processed on the desktop as a request for 768 boxes!) A similar problem occurs with 4-byte values; they are also stored in switched forms (see Table 15-2).

Table 15-2. Comparison of byte orderings for the 4-byte value 0x01020304

Palm handheld byte order

Wintel byte order

0x01
0x04
0x02
0x03
0x03
0x02
0x04
0x01

The Sync Manager ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Palm OS Network Programming

Palm OS Network Programming

Greg Winton
Palm Programming: The Developer's Guide

Palm Programming: The Developer's Guide

Neil Rhodes, Julie McKeehan

Publisher Resources

ISBN: 1565928563Errata Page