c++ - winapi entry point without WinMain -


so going through source of winapi program found online noticed there no winmain anywhere, wonder if possible in anyway ever make winapi program work this, why think original programmer did this, have dialog procedure :

 static int_ptr callback maindialogproc(hwnd hwnd, uint msg, wparam wparam,      lparam lparam) {  switch(msg)   {     case wm_initdialog:    {     //..............       }   } } 

and main entrypoint instead of void winapi winmain (void);

void winapi entrypoint(void) {  //........ } 

is possible? goes against have studied far... i'm sure i'm missing something...

the entry point executable image specified through linker setting /entry. if not explicitly set, defaults maincrtstartup (or wmaincrtstartup) console application, winmaincrtstartup (or wwinmaincrtstartup) gui application, , _dllmaincrtstartup dll. when using crt ships part of visual studio, of aforementioned raw entry points call user-provided entry points main (or wmain), winmain (or wwinmain), , dllmain, respectively. implemented in crt0.c ships part of visual studio's crt source code.

if provide own entry point (by specifying /entry linker option), must have following signature (for 32-bit application):

dword callback rawentrypoint(void); 


bonus reading: winmain conventional name win32 process entry point


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -