Now you can use LINK to create the DLL. The LINK utility uses the object module of the DLL code and the module definition to create the CSTR.DLL:
LINK CSTR.OBJ , , , , MYDYNLIB.DEF
If linking is successful, the linker creates a file with a .DLL extension.
You can link several modules together to create a DLL. The following command line links several object modules and an object-code library (BIGLIB.LIB) to form a DLL. The module-definition file is MYDYNLIB.DEF:
LINK MOD1 MOD2 MOD3,,, BIGLIB, MYDYNLIB
To use the DLL, copy the .DLL file to a directory listed in the LIBPATH setting in your CONFIG.SYS file.
To create an executable file using the DLL, link the client program with the import library as shown:
LINK CALLDLL.OBJ , , , MYDYNLIB.LIB
By running CALLDLL.EXE in separate OS/2 windows, you can see that both client programs access the DDL at the same time. When the last process exits the DLL, the DLL is removed from memory.