To build a DLL, use the macros defined for Linking. WIN32.MAK also includes the following macros to simplify linking DLLS:
This macro is used to invoke the library manager. It expands to the following flags:
lib
This macro is used as a suffix for the entry-point function. It is platform dependent. It defines to nothing on MIPS, Alpha, and PPC machines. It expands to the following flags on x86 machines:
@12
This macro is used for DLLs. It expands to the following flags:
-/NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO
-align:0x1000 -entry:_DllMainCRTStartup$(DLLENTRY) -dll
The following example illustrates how to create the import library for a DLL. The import library is linked with the application that uses this DLL.
mydll.lib: mydll.def mydll.obj
$(implib) -machine:$(CPU) -def:mydll.def mydll.obj -out:mydll.lib
The following example links the DLL:
mydll.dll : mydll.obj
$(link) $(ldebug) $(dlllflags) -base:0x1C000000 mydll.obj \
$(conlibsdll) -out:mydll.dll