Important: The information in this document is obsolete and should not be used for new development.
CFM-68K Shared Library Structure
In some development environments, creating a CFM-68K shared library involves first creating a segmented version of the library and then flattening it to produce a contiguous program that is stored in the file's data fork. In MPW, the mechanism for flattening segmented shared libraries is the MakeFlat tool. This section describes what conversions are necessary to go from a segmented state to a flattened state and how MakeFlat implements these conversions.You need to read this section in either of these two cases:
An unflattened shared library has a structure very similar to that of a CFM-68K runtime application. The main differences are as follows:
- You want to understand how the MPW MakeFlat tool flattens CFM-68K shared libraries.
- You are writing a library flattening tool and want to understand what conversions are necessary.
The structure changes radically, however, when you flatten the segmented library using the MakeFlat tool. MakeFlat makes the following changes to a segmented shared library:
- The transition vectors are 8 bytes long instead of 12.
- The PEF container's data section is not compressed.
- The
'cfrg'0
resource indicates that the fragment is a library, not an application.
After making these changes, MakeFlat writes the PEF container to the data fork of the output file.
- Converts the shared library's
'CODE'
resources (except for'CODE'0
and'CODE'6
) into code sections in the output PEF container.- Modifies the PEF relocations.
- Converts jump table entries and transition vectors to their flattened state.
- Compresses the PEF container's data section.
- Creates a new
'cfrg'0
resource specifying the new location of the PEF container.- Adds a debug section to the output PEF container so you can use the 68K Macintosh Debugger to debug shared libraries.
- Adds code to properly call static constructor or destructor routines if they exist in the shared library.
The following sections describe some of the conversions in greater detail.
Subtopics
- Jump Table Conversion
- Transition Vector Conversion
- Static Constructors and Destructors