Platform SDK: Tools |
WIN32.MAK contains the following macros to simplify linking applications:
This macro is used to invoke the linker. It expands to the following flags:
link
This macro is used for for specifying debugging, profiling, and tuning linker flags. When specifying debug, but no profiling or tuning, it expands to the following flags:
-debug:full -debugtype:cv
Use one of the following flags, depending on whether you are building a console application or a GUI application:
This macro is used for console applications. It is platform dependent. On x86 machines, it expands to the following flags:
-/NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO -align:0x1000 -subsystem:console,4.0 -entry:mainCRTStartup
This macro is used for GUI applications. it is platform dependent. On x86 machines, it expands to the following flags:
-/NODEFAULTLIB /INCREMENTAL:NO /PDB:NONE /RELEASE /NOLOGO -align:0x1000 -subsystem:windows,4.0 -entry:WinMainCRTStartup
Notice that these macros provide entry points in the CRT libraries. These CRT entry points will call your entry-point function (main or WinMain).
Use one of the following flags if you are using the single-threaded CRT:
This macro is for console applications using LIBC.LIB. It expands to the following list of libraries:
LIBC.LIB OLDNAMES.LIB KERNEL32.LIB ADVAPI32.LIB
This macro is used for GUI application using LIBC.LIB. It expands to the following list of libraries:
LIBC.LIB OLENAMES.LIB KERNEL32.LIB ADVAPI32.LIB USER32.LIB GDI32.LIB COMDLG32.LIB WINSPOOL.LIB
Use one of the following flags if you are using the multithreaded CRT:
This macro is for console applications using LIBCMT.LIB. It expands to the following list of libraries:
LIBCMT.LIB OLDNAMES.LIB KERNEL32.LIB ADVAPI32.LIB
This macro is used for GUI application using LIBCMT.LIB. It expands to the following list of libraries:
LIBCMT.LIB OLDNAMES.LIB KERNEL32.LIB ADVAPI32.LIB USER32.LIB GDI32.LIB COMDLG32.LIB WINSPOOL.LIB
Use one of the following flags if you are using the CRT in a DLL:
This macro is for console applications using MSVCRT.LIB. It expands to the following list of libraries:
MSVCRT.LIB OLDNAMES.LIB KERNEL32.LIB ADVAPI32.LIB
This macro is used for GUI application using MSVCRT.LIB. It expands to the following list of libraries:
MSVCRT.LIB OLDNAMES.LIB KERNEL32.LIB ADVAPI32.LIB USER32.LIB GDI32.LIB COMDLG32.LIB WINSPOOL.LIB
The following example links the object files and libraries to produce the application executable file. Note that the resource file (generic.res) is linked along with the object file (generic.obj).
generic.exe : generic.obj generic.res $(link) $(ldebug) $(guilflags) generic.obj generic.res \ $(guilibsdll) -out:generic.exe