nld Manual

Converting From Binder to nld
nld Manual528272-001
B-2
Linking Unit Differences
Linking Unit Differences
An important difference between nld and Binder is the unit of linking. In Binder, the
smallest unit of linking is a code or data block. In nld, the smallest unit of linking is an
entire object file. With nld, you cannot replace pieces of an object file, such as
individual procedures or data blocks, or pull them out and link them to create a new
object file; you can only combine one or more complete object files into a new object
file.
Because of this difference in the unit of linking, nld does not provide an option
comparable to the Binder SELECT SEARCH command. (The Binder SELECT
SEARCH command searches an object file to resolve external references and copies
into the target object file only those references that are resolved.)
Archives can often be used to replace the function provided by the Binder SELECT
SEARCH command. An archive is a single file that contains a collection of object files,
created by the ar utility. Any type of files may be placed into archives, but nld is only
concerned with archives that contain relinkable native object files.
You can create an archive containing the object files previously searched in Binder
SELECT SEARCH commands and specify that archive to nld. nld searches the
archive to resolve references and copies to the target object file those object files from
the archive that it used to resolve references. This is different from Binder in that nld
copies the entire object file, not just the individual procedure.
Depending on how you build your application, you might get procedures that you do
not want, in addition to the ones that you do want. This can result in link-time errors,
such as new unresolved references or multiple copies of procedures. If you want to be
able to get procedures out of archive files on an individual procedure basis, you can
compile such procedures separately so that they exist in the archive file as separate
object files.
This searching and linking behavior is comparable to most implementations. For more
information on archives and the ar utility, see the noft Manual. For information on
linking archives, see Linking Archive Files
on page 2-20.