Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

very simple (possibly even stupid) question

Status
Not open for further replies.

peterworth

Programmer
Aug 18, 2004
80
GB
what does _stdcall mean?
 
Well you usually see it when dealing with functions that are exported/imported, right?

Different languages generate different kind of code and concerning functions some push the prameters starting with the leftmost, others starts pushing from the rightmost parameter.

And that's what _stdcall handles. It ensures the parameters in the function signature are pushed in a well-defined behavior (from right to left).

Trivia: The _pascal directive is the exact opposite...

/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
what do you mean pushed? onto a stack? what stack? thanks.
 
Parameters passed to a functions are always pushed on the stack, the function access them by peeking into the stack.

The stack that for example also holds local variables.

What stack? The stack.


/Per
[sub]
"It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure."[/sub]
 
There's an easy way to see what's going on.

Write a function like
Code:
void foo(int a, int b, int c, int d)
{
	cout << a << b << c << d;;
}
....
  foo(0x11,0x22,0x33,0x44);

Set a breakpoint at the line calling foo.
Open the dissasebly window (In VC6 : View->Debug Windows->Dissasebly)
You'll see a whole lot of pushing there, like
Code:
0040148C   push        44h
0040148E   push        33h
00401490   push        22h
00401492   push        11h
just before the call is executed.

/Per
[sub]
&quot;It was a work of art, flawless, sublime. A triumph equaled only by its monumental failure.&quot;[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top