ADC Home > Reference Library > Technical Q&As > Tools > Compiling & Debugging >

Stub Library FAQ


Q: What goes in the ETO folder :Interfaces&Libraries:Libraries:SharedLibraries: ?

A: Only "stub" library files.

Q: What is a stub library?

A: A PEF shared library which has no code or data sections - only exports. The file type is 'stub' and creator is 'MPS '.

Q: How do I make a stub library?

A: Use the MPW tool MakeStub, which takes an export list as input.

Q: What is the difference between a stub library and a shared library?

A: A stub library is the "interface" to a shared library. A runtime library is the "implementation" of a shared library.

Q: Why was the concept of stub libraries created?

A: To separate interface and implementation of shared libraries. This is necessary if you want to build two or more shared libraries that are mutually dependent on one another. Without a stub library, you are in a Catch-22 and cannot link one without the other. Since the "interfaces" (i.e., the list of exports) for a shared library are usually frozen early on, a stub library can be created separately and the Catch-22 is removed.

Q: What if the Code Fragment Manager finds and tries to load a stub library which contains no code?

A: The file type of all stub libraries is 'stub'. CFM will not find and load shared libraries with this file type.

Q: How are stub libraries named?

A: Stub libraries must have the same fragment name and PEF versioning as the implementation library, but the file name can differ. Our convention is that the stub library file name should be the same as the fragment name. If we've been shipping the stub library with a different file name, we will keep that file name to avoid breaking developer's builds.

Q: Should stub libraries be "fat"?

A: If a shared library is available in both PowerPC and CFM-68K forms, a fat stub library should be created for it. You will need to run MakeStub twice (once for CFM-68K and once for PowerPC) and then MergeFragment them into one file.

Note:
It is our convention that PowerPC and CFM-68K fragments that implement the same functionality should use the same fragment name (e.g., "InterfaceLib" is the fragment name used by both CFM-68K and PowerPC).

[Mar 14 1997]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.