/ENTRY

Syntax:

/ENTRY:function

This option sets the starting address for an executable file or DLL. Specify a function name that is defined with cDEC$ ATTRIBUTES STDCALL. The parameters and return value must be defined as documented in the Win32 API for WinMain (for an .EXE) or DllEntryPoint (for a DLL). It is recommended that you let the linker set the entry point.

By default, the starting address is a function name from the run-time library. The linker selects it according to the attributes of the program, as shown in the following table.

Function Name Default for
mainCRTStartup An application using /SUBSYSTEM:CONSOLE; calls main
WinMainCRTStartup An application using /SUBSYSTEM:WINDOWS; calls WinMain, which must be defined with the cDEC$ ATTRIBUTES STDCALL attribute
_DllMainCRTStartup A DLL; calls DllMain (which must be defined with the STDCALL attribute) if it exists

If the /DLL or /SUBSYSTEM option is not specified, the linker selects a subsystem and entry point depending on whether main or WinMain is defined.

The functions main, WinMain, and DllMain are the three forms of the user-defined entry point.