Macro Function Stucture

I just learned c++ with the turorial on this website, but I know programming java. I have a question concerning this code lines:

1
2
DECLARE_STDCALL_P(struct hostent *) gethostbyname(const char*);
unsigned long PASCAL inet_addr(const char*);


What does the first code line mean? Is DECLARE_STDCALL_P an object of a class (defined to a macro)?

I know that PASCAL is a macro, but what is it's use?
What kind of macro is that? I don't know the syntax with a macro inside of a function declaration.

Thank you for all answers.
When a function is called in C, the arguments are pushed onto the stack from left to right, and on return, the caller pops the stack because only the called knows how many arguments were pushed. This is to support variable argument functions like printf. This is called the C calling convention.

Windows was born on DOS, a very resource starved unsafe environment. Windows uses the Pascal calling convention to save the callers doing all those pops. You give up variable arguments, but this allows the called function to pop the stack, and because the number of args passed is always the same, it knows exactly how much to pop the stack by.

The C and C++ compilers use C calling convention by default. Any other convention must be specified explicit somewhere.
Last edited on
Topic archived. No new replies allowed.