postlink(1)

NAME
postlink - Portable Object Compiler Postlink Tool

SYNOPSIS
postlink [ options ] [ - ] [ linkmap [ outfile ] ]

DESCRIPTION
postlink is a tool that takes a link map as input and that writes a C program to the stdout or to outfile. The program essentially consists of a table of all Objective-C classes that are linked into the program (as indicated by the link map). The name stems from the fact that the C program is then compiled by the objc driver and linked into the program after a first link. The objcrt runtime can use this table for initializing all classes.

AUTOMATIC INITIALIZATION
Most UNIX objc drivers are by default configured for automatic initialization, and do NOT use this tool. Automatic initialization determines at run-time what classes are linked into the program, and does not need a compile-time generated table of classes or a double link. It is still possible to suppress automatic initialization by using the -postlink option. Conversely, some non-UNIX drivers that are configured with postlink by default, can be used with the -noPostlink flag, but beware that, in general, the reason to configure a driver with postlink is that the automatic initialization code doesn't work for the particular platform.

EXAMPLE
The command:
    nm a.out | postlink > file.c
writes a C file to file.c that can be used by the objcrt runtime for initialization. The table consists of BIND functions that need to be called for all modules that were compiled with the objc compiler. Note that this includes all modules that need to be initialized, whether they define a class, or just send an Objective-C message.

OPTIONS

-a file
    Append file to the postlink output. This can be used to prepare Objective-C packages that, when loaded with dlopen(), automatically initialize themselves. Classes defined in the package will automatically register themselves to the runtime. The file that is appended to the postlink output, typically contains some C code to process the postlink output (initializers, finalizers).

-o file
    Place output in file

-p symbol
    Prepend symbol to the name _objcModules. This option can be used when building tables of BIND functions for shared objects that are going to be dynamically loaded by a program (e.g. with dlopen()); in this case the program needs more than just one _objcModules table.

-f format
    Currently format can be one of unix, watcom msvc ibmvac or metrowerks. The default format is unix. If the format is unix, then the input is assumed to be the output of the nm command (preferably the BSD nm format). If the format is watcom, then the input is assumed to be a WATCOM wlink link map, as generated with option map=.

FILES
$OBJCDIR/lib/_prelink.o    prelink stub file

SEE ALSO
objc(1), nm(1)