Sometimes, I see while disassembling a binary that there is the main
function. but sometimes, instead of main
, there is entry
function.
I want to know what is the difference between entry
and main
.
Main
is usually a programmer-defined entry point, while entry
is defined by the compiler, it's doing many other operations such as libc
initializations, heap allocation, and so on, and eventually, call the user-defined main
entry point. You can see main
as a callback function that defined by the user and eventually called by entry
.
The entry function you mentioned is the function where the entry point of the program is located. This entry function contains the first instructions of the program executed when you run the program.
The main function recognized by disassemblers is the the function where the main function of the program which code is compiled directly from the the developer's main function code.