Linking

When linking object modules with a large number of exports, it is advisable to avoid the re-creation of the import library if the export list has not changed. This is because generating the import library can account for a large percentage of the link time.

For example, instead of linking with:

link -out:foo.dll -def:foo.def <list of objects>

which creates the import library and export list each time, use:

link -lib -out:foo.lib -def:foo.def <list of objects>
link -out:foo.dll foo.exp <list of objects>

This two-step process creates the import library and export list on the first link. The second link does not create the import library. The first time you link, use both commands. On subsequent links, use only the second link command, thus speeding up the link time. You do not need to use the first link command again until the import library needs to be re-created.

Warning If you change the function name, class, calling convention, return type, or any parameter, the decorated name is no longer valid. You must use the new version of the decorated name and use it everywhere the decorated name is specified. You can view decorated names either by using a compiler listing, or by using the DUMPBIN tool on the .OBJ or .LIB file with the /SYMBOLS option.

Using _ _declspec(dllimport) and _ _declspec(dllexport) is highly recommended because hand written .DEF files will most likely need to be rewritten for Alpha. If you use _ _declspec, the compiler and linker automatically make all of the needed files. This is particularly important with C++ where calling conventions are mangled with function names during the decoration process.