Silverfrost Logo About Us | Contact Us
 

Generation of DLLs and exporting of functions

Since DLLs are run time libraries, it follows that they can also provide routines for other applications that are running. These routines have to be exported in order to make them available to other applications. A DLL must have some exports.

The export command will make a function (or a variable) available to other applications by inserting it into the export table in the DLL.

If you wish all of your functions to be exported, unless otherwise specified by the exportx command, then the exportall command will insert them all into the export table.

The exportx command will prevent functions from being inserted into the export table. The export command overrides the exportx command.

The dll command is used to specify that a DLL is to be built.

If your DLL contains a large number of routines (some internal and some for export) then you can use exportall as a simple expedient. If subsequently, an executable duplicates the name of a routine that was designed to be internal to the DLL, then use the SLINK command permit_duplicates, otherwise SLINK will fail to carry out the linking. You should also ensure that the executable objects are loaded (into SLINK) before the DLL.

The following example will generate a DLL named MYDLL.DLL. All of the functions within MYDLL.OBJ are exported.

slink
$ dll
$ lo mydll.obj
$ exportall
$ file

Note that the filename extension .DLL is appended by SLINK.

Import libraries can be generated by using the archive command. In which case, all of the exported functions will have the necessary members added to the import library to enable them to be linked with the DLL at runtime.

 

 

Copyright © 1999-2017 Silverfrost Limited