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.
Asked
Active
Viewed 1,542 times
5
lucky thandel
- 143
- 7
2 Answers
16
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.
macro_controller
- 1,858
- 10
- 28
1
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.
Minh-Triet Pham Tran
- 251
- 1
- 8