Click here to Skip to main content
15,922,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: First Win32 Program Pin
Blake Miller9-Feb-05 8:05
Blake Miller9-Feb-05 8:05 
GeneralRe: First Win32 Program Pin
Ryan Binns9-Feb-05 17:44
Ryan Binns9-Feb-05 17:44 
GeneralRe: First Win32 Program Pin
Blake Miller10-Feb-05 4:07
Blake Miller10-Feb-05 4:07 
GeneralRe: First Win32 Program Pin
Ryan Binns10-Feb-05 12:42
Ryan Binns10-Feb-05 12:42 
GeneralRe: First Win32 Program Pin
Blake Miller11-Feb-05 4:02
Blake Miller11-Feb-05 4:02 
GeneralRe: First Win32 Program Pin
Ryan Binns11-Feb-05 13:22
Ryan Binns11-Feb-05 13:22 
GeneralRe: First Win32 Program Pin
David Crow10-Feb-05 9:32
David Crow10-Feb-05 9:32 
GeneralThe 'Call' instruction Pin
Rajas P9-Feb-05 4:28
Rajas P9-Feb-05 4:28 
I have following code in a cpp file:

//test.cpp
int __cdecl calc1 (int a, int b, int c) {
return (a+b-c);

}

int __cdecl calc2 (int a, int b) {
return (a+b);

}


void main() {

int r = calc1(10,20,5);
r = calc2(10,20);

}

I have compiled this with 'cl' command. Then, with "dumpbin /disasm test.obj command I created following file: (I have removed the headers here)

?calc1@@YAHHHH@Z (int __cdecl calc1(int,int,int)):
00000000: 55 push ebp
00000001: 8B EC mov ebp,esp
00000003: 8B 45 08 mov eax,dword ptr [ebp+8]
00000006: 03 45 0C add eax,dword ptr [ebp+0Ch]
00000009: 2B 45 10 sub eax,dword ptr [ebp+10h]
0000000C: 5D pop ebp
0000000D: C3 ret
?calc2@@YAHHH@Z (int __cdecl calc2(int,int)):
0000000E: 55 push ebp
0000000F: 8B EC mov ebp,esp
00000011: 8B 45 08 mov eax,dword ptr [ebp+8]
00000014: 03 45 0C add eax,dword ptr [ebp+0Ch]
00000017: 5D pop ebp
00000018: C3 ret
_main:
00000019: 55 push ebp
0000001A: 8B EC mov ebp,esp
0000001C: 51 push ecx
0000001D: 6A 05 push 5
0000001F: 6A 14 push 14h
00000021: 6A 0A push 0Ah
00000023: E8 00 00 00 00 call 00000028
00000028: 83 C4 0C add esp,0Ch
0000002B: 89 45 FC mov dword ptr [ebp-4],eax
0000002E: 6A 14 push 14h
00000030: 6A 0A push 0Ah
00000032: E8 00 00 00 00 call 00000037
00000037: 83 C4 08 add esp,8
0000003A: 89 45 FC mov dword ptr [ebp-4],eax
0000003D: 8B E5 mov esp,ebp
0000003F: 5D pop ebp
00000040: C3 ret

On line 00000023 in the main function it calls calc1 function,
But no where address of calc1 (00000000) is mentioned.
The same case happens when call to calc1 (0000000E) is made.
So, how the control will be transferred to respective functions?

Could anyone help me in understanding the working of call instruction and explain the calling of proper function in the above case?
GeneralRe: The 'Call' instruction Pin
Antony M Kancidrowski9-Feb-05 5:29
Antony M Kancidrowski9-Feb-05 5:29 
GeneralRe: The 'Call' instruction Pin
Ryan Binns9-Feb-05 17:52
Ryan Binns9-Feb-05 17:52 
GeneralSNTP server Pin
Anonymous9-Feb-05 4:10
Anonymous9-Feb-05 4:10 
GeneralRe: SNTP server Pin
markkuk9-Feb-05 12:22
markkuk9-Feb-05 12:22 
GeneralCDatabase OpenEx Error Connecting Pin
KatyLee9-Feb-05 4:04
sussKatyLee9-Feb-05 4:04 
GeneralRe: CDatabase OpenEx Error Connecting Pin
David Crow9-Feb-05 4:07
David Crow9-Feb-05 4:07 
GeneralRe: CDatabase OpenEx Error Connecting Pin
KatyLee9-Feb-05 4:48
sussKatyLee9-Feb-05 4:48 
GeneralRe: CDatabase OpenEx Error Connecting Pin
David Crow9-Feb-05 5:05
David Crow9-Feb-05 5:05 
QuestionFindText() and FindText2() functions in CHtmlView class for searching on different pages. Is it possible? Pin
bilas9-Feb-05 3:46
bilas9-Feb-05 3:46 
Questiona question for ListCtrl ? Pin
wushli9-Feb-05 2:23
wushli9-Feb-05 2:23 
AnswerRe: a question for ListCtrl ? Pin
David Crow9-Feb-05 2:26
David Crow9-Feb-05 2:26 
AnswerRe: a question for ListCtrl ? Pin
RChin9-Feb-05 5:53
RChin9-Feb-05 5:53 
AnswerRe: a question for ListCtrl ? Pin
Shog99-Feb-05 9:12
sitebuilderShog99-Feb-05 9:12 
GeneralSimplifying fractions in cpp Pin
Member 19169269-Feb-05 2:06
Member 19169269-Feb-05 2:06 
GeneralRe: Simplifying fractions in cpp Pin
Maximilien9-Feb-05 3:02
Maximilien9-Feb-05 3:02 
GeneralRe: Simplifying fractions in cpp Pin
Member 19169269-Feb-05 3:10
Member 19169269-Feb-05 3:10 
GeneralRe: Simplifying fractions in cpp Pin
David Crow9-Feb-05 4:05
David Crow9-Feb-05 4:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.