Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Mac OS Runtime Architectures /
Chapter 9 - CFM-68K Application and Shared Library Structure / CFM-68K Shared Library Structure


Static Constructors and Destructors

In MPW, if the input shared library contains static constructors or destructors, the MakeFlat tool performs special processing to ensure these routines are called at the proper time.

MakeFlat adds a block of data to the top of the A5 world and adds a new code section. The data block consists of two new transition vectors, offsets to the library's original initialization and termination routines, and the contents of the code segment %_Static_Constructor_Destructor_Pointers. The new code section, %_CPlus_Static_Init_Term, contains the two routines that call the static constructors and destructors. These two routines are then marked as being the library's initialization and termination routines.

Note
Because MakeFlat takes care of static object construction and destruction, you do not need to call the MPW routines __init_lib and __term_lib when creating your own initialization and termination routines for shared libraries. However, when creating routines for CFM-68K runtime applications, you must call the corresponding __init_app and __term_app routines.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 MARCH 1997