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 3 - Programming for the CFM-Based Runtime Architecture / Import Library Techniques


Declare Weak Symbols in Client

If symbols are added to a newer version of an import library, the developer can make sure that the newer clients can still link to the older library by declaring the new symbols to be weak. This method, however, has two drawbacks: the client application must check for all weak imports, and the developer must keep track of all weak exports.

For example, say you have a library mooLib 1.0, which contains the symbols dog and cow. Later you update mooLib to 2.0 by adding the symbols woof and moof. If woof and moof are declared weak by a client built with mooLib 2.0, the client can still run with mooLib 1.0; it just cannot use the symbols woof and moof.

The developer's code must check for the presence of all weak symbols before attempting to use them and perhaps inform the end user of any limited functionality if some symbols are not present. In addition, each time a new version of the library is created, the developer must create a new weak export list. For example, building clients with mooLib 2.0 requires a weak export list of all symbols added after version 1.0. Building with version 3.0 would require a list of weak symbols added between 1.0 and 2.0 and a list of symbols added between 2.0 and 3.0. When building libraries for other developers, the developer would have to supply an updated export list for every version released.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 MARCH 1997