Care should be taken on importing DLLs. The mechanism is designed to replace the importation of "pure" import libraries. It is possible that the .LIB file contains loadable library code in addition to the imported symbol. In such cases, the loadable library code is missing from the DLL and so cannot be loaded. SALFLIBC.LIB is such a library, the DLL SALFLIBC.DLL cannot be loaded directly since it does not contain, for example, the symbol _SALFStartup which is necessary for initialisation and to provide the application's entry point.
Direct import of dynamic link libraries require that the exported names in the DLL follow the following rules
_ _stdcall symbols
The exported name is created by removing the leading underscore and does not contain the appended @ and subsequent characters
e.g. _MessageBeep@4 will be exported as MessageBeep
Symbols beginning with a leading underscore
The leading underscore is removed.
All other symbols are assumed to be exported unchanged.
Archive and import library generation
Archives and import libraries may be generated without any objects being loaded with the load command.
For example the following SLINK script will generate a combined RLB and import library. Note that the file command is necessary to initiate the build. Ignore the comments in brackets
file to be called mylib.LIB)
dll (module name set to mylib.DLL)
The executable file needs an entry point that is called by the system loader immediately after the program has been loaded. This entry point is not the main, WinMain or LibMain function as you may think, but library startup code. The Silverfrost entry point for all executables, including DLLs is _SALFStartup. Object files produced by other compilers will have a different entry point which you will have to set explicitly.
The entry point is specified with the entry command, omitting the leading underscore. SLINK will automatically set the entry point to be _SALFStartup unless you use the entry command before any objects files have been loaded. In command line mode the entry command can be placed anywhere in the command line or script file since commands are always processed first.
e.g. The following command will set the entry point to be _SALFStartup. This is redundant since SLINK will do this for you.
You cannot change the entry point after the first object file has been loaded or if an entry command has previously been used.