When you compile a program that uses a smart-linked unit, the compiler will only link in the code that you actually need, and will leave out all other code. This will result in a smaller binary, which is loaded in memory faster, thus speeding up execution.
To enable smartlinking, one can give the smartlink option on the command line: -Cx, or one can put the f$SMARTLINK ONg directive in the unit le:
Unit Testunit
{SMARTLINK ON} Interface ... |
Smartlinking will slow down the compilation process, especially for large units.
When a unit foo.pp is smartlinked, the name of the code le is changed to libfoo.a.
Technically speaking, the compiler makes small assembler les for each procedure and function in the unit, as well as for all global de ned variables (whether they're in the interface section or not). It then assembles all these small les, and uses ar to collect the resulting object les in one archive.
Smartlinking and the creation of shared (or dynamic) libraries are mutually exclusive, that is, if you turn on smartlinking, then the creation of shared libraries is turned of. The creation of static libraries is still possible. The reason for this is that it has little sense in making a smartlinked dynamical library. The whole shared library is loaded into memory anyway by the dynamic linker (or the operating system), so there would be no gain in size by making it smartlinked.