How does a C/C++ program call the main() function?
cristi:test diciu$ otool -l ./a.out | grep -A 10 LC_UNIXTHREAD cmd LC_UNIXTHREAD cmdsize 80 flavor i386_THREAD_STATE count i386_THREAD_STATE_COUNT [..] ss 0x00000000 eflags 0x00000000 eip 0x00001f8c cs 0x00000000 [..]
cristi:test diciu$ nm ./a.out 0000200c D _NXArgc 00002008 D _NXArgv 00002000 D ___progname 00001fe0 t __dyld_func_lookup 00001000 A __mh_execute_header [..] 00001f8c T start
(gdb) b start Breakpoint 1 at 0x1f90 (gdb) b main Breakpoint 2 at 0x1ff4 (gdb) r Starting program: /Users/diciu/Programming/test/a.out Reading symbols for shared libraries ++. done Breakpoint 1, 0x00001f90 in start ()
Source: By as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 4.0
- How do I use the C socket API in C++ on Linux?
- What's the API for GTK messagebox?
- Why am I getting double free error when I call realloc()?
- How do I map Streams in C#. Mapping Streams to Data Structures in C#: Can I understand the structure of Streams?
- How do you format an unsigned long int using printf?
- As function arguments, passing multidimensional arrays in C. In C, passing multidimensional arrays are no longer used and can be used as function arguments (again in a code library) in C. The examples below illustrate this.
- How do you create a sparse array?
- String.indexOf in C is the most important function. It is useful for any user of C with little knowledge about C syntax.
- What are the barriers to understanding pointers?
- Is lazy construction of singleton a thread safe?
- How to avoid redefining VERSION, PACKAGE, etc. How to avoid redefining VERSION, PACKAGE, etc.?
- How do I make a GUI?
- Of Memory Management, Heap Corruption, and C++. Of Memory Management, C++.
- Testing a function that throws on failure.
- What is the difference between shift operators (, >>) and logical operators in C?