I found that when I compile my C / C ++ programs with VS2010 (I did not check other compilers) in debug mode, when I look at disassembly, all function calls, be it library functions, my own functions, function class- members etc. all have a two-stage call. The actual function call is converted to an instruction callat address A. When I go to address A, I see that this is some sort of a large list of instructions jmp, each of which has a different function. A (small) part may look like this:
fooFunc:
08CB1776 jmp fooFunc (8D11F60h)
barFunc:
08CB177B jmp barFunc (8D25240h)
std::allocator<unsigned int>::max_size:
08CB1780 jmp std::allocator<unsigned int>::max_size (8CE3D00h)
std::_Copy_backward_opt<int *,int *>:
08CB1785 jmp std::_Copy_backward_opt<int *,int *> (8D325D0h)
std::_Checked_base<int *>:
08CB178A jmp std::_Checked_base<int *> (8D32360h)
@ILT+1950(_foobarFunc):
08CB17A3 jmp foobarFunc (8F31450h)
@ILT+1955(_anotherFunc):
08CB17A8 jmp anotherFunc (8E4BD20h)
std::vector<unsigned short,std::allocator<unsigned short> >::capacity:
08CB17B2 jmp std::vector<unsigned short,std::allocator<unsigned short> >::capacity (8D8AAF0h)
yetAnother:
08CB17B7 jmp yetAnother (8D18630h)
@ILT+1975(_f):
08CB17BC jmp f (8E4FC50h)
std::_Debug_range<char *>:
08CB17C6 jmp std::_Debug_range<char *> (8D32480h)
std::_Vector_const_iterator<MyClass *,std::allocator<MyClass *> >::operator+=:
08CB17CB jmp std::_Vector_const_iterator<MyClass *,std::allocator<MyClass *> >::operator+= (8D64C80h)
These instructions jmp, in turn, go to the actual function bodies. This only happens when compiling in debug mode. In Release functions, calls are compiled into direct calls to the function body.
?