/ENTRY (Entry-Point Symbol)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at -ENTRY (Entry-Point Symbol).

ENTRY:function

  
## Remarks  
 where:  
  
 *function*  
 A function that specifies a user-defined starting address for an .exe file or DLL.  
  
## Remarks  
 The /ENTRY option specifies an entry point function as the starting address for an .exe file or DLL.  
  
 The function must be defined with the `__stdcall` calling convention. The parameters and return value depend on if the program is a console application, a windows application or a DLL. It is recommended that you let the linker set the entry point so that the C run-time library is initialized correctly, and C++ constructors for static objects are executed.  
  
 By default, the starting address is a function name from the C 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** (or **wmainCRTStartup**)|An application using /SUBSYSTEM:**CONSOLE**; calls **main** (or **wmain**)|  
|**WinMainCRTStartup** (or **wWinMainCRTStartup**)|An application using /SUBSYSTEM:**WINDOWS**; calls `WinMain` (or **wWinMain**), which must be defined with `__stdcall`|  
|**_DllMainCRTStartup**|A DLL; calls `DllMain`, which must be defined with `__stdcall`, if it exists|  
  
 If the [/DLL](../Topic/-DLL%20\(Build%20a%20DLL\).md) or [/SUBSYSTEM](../Topic/-SUBSYSTEM%20\(Specify%20Subsystem\).md) 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.  
  
 When creating a managed image, the function specified with /ENTRY must have a signature of (LPVOID *var1*, DWORD *var2*, LPVOID *var3*).  
  
 For information on how to define your own DllMain entry point, see [Run-Time Library Behavior](../Topic/Run-Time%20Library%20Behavior.md) .  
  
### To set this linker option in the Visual Studio development environment  
  
1.  Open the project's **Property Pages** dialog box. For details, see [Setting Visual C++ Project Properties](../Topic/Working%20with%20Project%20Properties.md).  
  
2.  Click the **Linker** folder.  
  
3.  Click the **Advanced** property page.  
  
4.  Modify the **Entry Point** property.  
  
### To set this linker option programmatically  
  
-   See [EntryPointSymbol](assetId:///P:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.EntryPointSymbol?qualifyHint=False&autoUpgrade=True).  
  
## See Also  
 [Setting Linker Options](../Topic/Setting%20Linker%20Options.md)   
 [Linker Options](../Topic/Linker%20Options.md)


Show: