What is the entry point for GUI programs in linux?
In Windows it is WinMain
What’s in Linux?
Or main
?
Solution
The Windows PE (Portable Executable) format has a flag in the header that indicates whether the executable is console or windowed. Windows will assign a console window depending on which application it is, or not. This also determines whether the entry point is main
or WinMain
.
The Linux ELF format does not have a similar flag. The entry point is always main
. The concept of a “console window” is completely different in Linux.
(Note that the code above simplifies the problem somewhat, since the entry point you are talking about is where the user code begins.) The compiler/linker always provides some runtime library startup code that is called before the user entry point that runs your is called, which is the real entry point. )