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

7    Shared Library Definition File Format Reference

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

Palm OS® Developer Suite

This chapter provides reference information on the shared library definition (SLD) file format.

Creating a Shared Library Definition File ^TOP^

Shared library definition (SLD) files are text files. You can use any text editor to create an SLD file. In the SDK samples, shared library files commonly have the filename extension .sld, but this extension is not required.

The file is arranged as a set of keyword/value pairs, separated with white space (with the exception of the EXPORT keyword as described below).

To add comments to an SLD file, use a semi-colon (;) character. If a line starts with a semi-colon, the entire line is treated as a comment. For any line that contains a semi-colon, pslib will ignore all of the characters that appear after the semi-colon character.

Specifying Keywords ^TOP^

Note that keywords are not case sensitive but the values specified are case sensitive.

TYPE four_character_code
Defines the type of the library.
CREATOR four_character_code
Defines the creator of the library.
REVISION integer
Specifies the revision number of the library
integer
A user-defined version non-negative number.
RESOURCEID integer
Specifies the resource ID of this library.
integer
A non-negative number. For PRC files that have more than one library, this value makes the libraries unique.
ENTRY name
Specifies the name of the entry point for this module. The ENTRY keyword is not required if your application's only entry point is the function PilotMain().
PATCHABLE [0 | 1]
Defines the default patchability state for exported functions in the module.
0
By default, the library is unpatchable.
1
By default, the library is patchable.
OSVERSION version
Defines the minimum Palm OS version necessary to load this library. Use zero (0) if there is no minimum Palm OS version required.
ARMARCH [4T | 5T | 5TE | 0]
Defines the minimum ARM architecture necessary to load this library. Use zero (0) if there is no minimum ARM architecture required.
This value has meaning only for Palm OS device targets; it is not applicable for Palm OS Simulator targets.
EXPORTS export_identifier
Each line in the SLD file after the EXPORTS keyword defines a function name being exported. export_identier is one of the following:
None
Indicates that there are no functions being exported.
name [entry_id] [patch_indicator]
Specifies a list of the names of the exported functions. An entry ID and patchability indicator may be associated with each function (separated by whitespace on the same line as the function name).
entry_id
If entry_id is specified, each function must have a unique entry ID. The function list must be sorted by entry point number, from 0 to n.
If you skip numbers in the list of entry points, the skipped entry points are treated as not implemented (or reserved) functions. For these reserved functions, pslib creates dummy functions. If such a function is called from a Palm OS application, Palm OS calls the SysUnimplemented() function.
patch_indicator
The patchability indicator has two values: patchable and unpatchable. If there is no patchability indicator, the default is defined by the PATCHABLE keyword or by pslib's -patchable command-line option.

Sample Shared Library Definition Files ^TOP^

The section shows two sample SLD files:

  • For a sample Palm OS application SLD file, see Listing 7.1.
  • For a sample Palm OS shared library SLD file, see Listing 7.2.

Listing 7.1  Sample SLD File for an Application


; 
; DateBook Library Definition File 
; 
 
TYPE                  appl  
CREATOR               dats  
REVISION                1  
RESOURCEID              0  
 
ENTRY _PalmUIAppStartup  

Listing 7.2  Sample SLD File for a Shared Library


; 
; MathLib Library Definition File 
; 
 
TYPE                  slib 
CREATOR               math 
REVISION                1 
RESOURCEID              0 
 
; Shared Libraries have one entry  
ENTRY MathLibMain 
 
; Shared Library Exports List  
EXPORTS 
        fabs 
        ceil 
        floor 
        rint 
        fmod 
        remainder 
        frexp 
        ldexp 
        modf 
        scalbn 
        exp 
        expm1 
        ilogb 
        log 
        log10 
        log1p 
        logb 
        cbrt 
        hypot 
        pow 
        sqrt 
        cos 
        sin 
        tan 
        cosh 
        sinh 
        tanh 
        acos 
        asin 
        atan 
        atan2 
        acosh 
        asinh 
        atanh 
        erf 
        erfc 
        lgamma 
        gamma 
        isnan 
        finite 
        copysign 
        nextafter 
        j0 
        j1 
        jn 
        matherr