Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

1    Understanding Palm OS Application Development

Palm OS® Protein C/C++ Compiler Tools Guide

Palm OS® Developer Suite

This chapter gives you an overview of the application development process for Palm OS®, describing how to use the compiler, linker, shared library tool, and post linker to develop applications.


NOTE: This overview is a simplification of the entire Palm OS application development process, with an emphasis on how the developer tools convert source files into an executable application. For a more complete description, see Exploring Palm OS: Programming Basics.

Building a Palm OS Application ^TOP^

When you write a Palm OS application, you generally need to define three things:

  • The program logic. Most programs for Palm OS are written in C or C++. These source files are compiled into code resources.
  • The user interface controls and data. Palm OS Protein application user interfaces are written in an XML format. XML Resource Definition (XRD) files are compiled into temporary resource (TRC) files.
  • Optionally define the entry points to the application. Palm OS Protein applications can have multiple entry points, though most will have a single entry point.

    If your application has a single entry point, you can use the PilotMain() function as described in the book Exploring Palm OS: Programming Basics.

    If your application has multiple entry points, you need to create a Shared Library Definition (SLD) file. For an application, your SLD file's first entry point is _PalmUIAppStartup; this entry point will call your application's PilotMain() function. Your other entry points can have arbitrary C prototypes. For more information on SLD files, see Chapter 7, "Shared Library Definition File Format Reference."


NOTE: Entry points can only be C functions; C++ methods cannot be used as entry points.

Figure 1.1 provides an overview of the build process.

Figure 1.1  Palm OS Application Development Overview

As shown in Figure 1.1, these developer tools are used in the build process:

  • The compiler tools compile the C source files into ELF object files. The compiler tools are described in this book.

    For more information about the compiler tools, see Chapter 2, "Introducing Palm OS Compiler Tools,".

  • For applications, the shared library tool compiles the shared library definition (SLD) file into a single ELF object file. The shared library tool, pslib, is described in this book.

    For more information about pslib, see Chapter 5, "Using the Palm OS Shared Library Tool,".

  • The resource tools, specifically PalmRc, compile the XML Resource Definition (XRD) file into a temporary resource (TRC) file. For more information about the resource tools, see Palm OS Resource Tools Guide.
  • The linker combines ELF object files into a single ELF object file. For more information about the linker, see "Palm OS Linker."
  • The post linker converts the ELF object file into binary resource files that can be merged into a Palm OS application. The post linker, pelf2bin, is described in this book.

    For more information about pelf2bin, see Chapter 6, "Using the Palm OS Post Linker."

  • One of the resource tools, PRCMerge, combines the code resource, data resource, and temporary resource files into the final Palm OS application (PRC) file. For more information about PRCMerge, see Palm OS Resource Tools Guide.

Building a Palm OS Shared Library ^TOP^

The process for building a Palm OS shared library is similar to the process for building a Palm OS application. However, for shared libraries, the shared library definition (SLD) file defines a unique entry point and generally defines multiple exports from the library.

When pslib compiles the SLD file for a library, it produces two object files:

  • An ELF object file containing the startup code for each library function. This object file is linked together with the library's object files that you get from compiling the C or C++ source code.
  • An ELF object file containing the stub code for each library function. This object file is linked with the program that calls the library's function.