Search notes:

link /ENTRY

The /ENTRY option specifies the symbol of the start address (entry point) for an exe or a dll.
This entry point is expected to have stdcall calling convention.

Default entry points

/SUBSYSTEM:CONSOLE mainCRTStartup or wmainCRTStartup crt0.c
/SUBSYSTEM:WINDOWS WinMainCRTStartup or wWinMainCRTStartup wincrt0.c, mcrtexe.cpp
/DLL _DllMainCRTStartup dllcrt0.c

Specifying a non default entry point

The following little progam simply creates a message box and returns 42. Thus, it does not need the CRT and can be linked with /nodefaultlib.
#include <windows.h>

int __stdcall entryFunc(void) {

      MessageBoxA(NULL, "Hello", "entryFunc", 0);
      return 42;

}
Github repository about-cl, path: /linker/options/entry/app.c
Because it does not use the CRT, there is no main function either and consequently no default entry point.
Because the linker does not find one of the default entry points, it needs to be specfied with the /ENTRY option.
Additionally, without default entry point, the linker cannot determine the target subsystem. Thus, it must be specified with the /SUBSYSTEM linker option. Otherwise, the linker will complain with the error message fatal error LNK1221: a subsystem can't be inferred and must be defined.
The subsystem is chosen to be console in order to be able to check the exit value of app.exe with %errorlevel%.
The Makefile to create app.exe:
app.exe: app.obj
	link /nodefaultlib app.obj /entry:entryFunc /subsystem:console user32.lib /out:app.exe

app.obj: app.c Makefile
	cl /nologo /c /W4 /GS- app.c
Github repository about-cl, path: /linker/options/entry/Makefile

Index