I thought i had complex declarations nailed, as in i could tell you what a pointer to an array of functions that returned int and took doubles as arguments looked like i find this little horror:

/Return the IP address of a domain name


DECLARE_STDCALL_P(struct hostent *)  gethostbyname(const char*);

//Convert a string address (i.e., "127.0.0.1") to an IP address. Note that  

//this function returns the address into the correct byte order for us so 

//that we do not need to do any conversions (see next section)


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

what is this? Looks like two function declarations but without return types and no semi colons separating them?

Also:

unsigned long PASCAL inet_addr(const char*);

what the hell is the PASCAL doing there? without that it would make sense to me: a function called inet_addr that took a const char* as a parameter and returned a ulong.

Please help this is driving me crazy!

Edited 7 Years Ago by Vitriolics: idioacy

OK, well...I'm not familiar with this code, so I don't know exactly where it's from but:

DECLARE_STDCALL_P(struct hostent *)   gethostbyname(const char*);

breaking it down into three parts:
DECLARE_STDCALL_P is some kind of macro...Offhand I'm not sure exactly what it does...probably registers the function with some system mechanism or other..
(struct hostent *) - I think this is the return type of the function, a pointer to a struct....saying that the fact it's in brackets could mean that it's a parameter to the macro...Either way, with or without the macro, this is almost certainly the return type!

gethostbyname(const char*); - The easy bit. This is definitely the name of the function and its parameter list.

As for:

unsigned long PASCAL inet_addr(const char*);

I'm not entirely sure, but I think the return type is an unsigned long, but in PASCAL format....Perhaps inet_addr function makes some kind of external function call to an older part of the system that was written in pascal and it's return value is based on it's call to said external function??

I know in windows there are (or at least were) a lot of external functions in .dll's and libraries that were written in PASCAL (Not sure if many are left nowadays), So it's a possibility!

I'm sure one of the more senior programmers here can give you a more concrete answer!

Cheers for now,
Jas.

Edited 7 Years Ago by JasonHippy: n/a


As for:

unsigned long PASCAL inet_addr(const char*);

I'm not entirely sure, but I think the return type is an unsigned long, but in PASCAL format....Perhaps inet_addr function makes some kind of external function call to an older part of the system that was written in pascal and it's return value is based on it's call to said external function??

I know in windows there are (or at least were) a lot of external functions in .dll's and libraries that were written in PASCAL (Not sure if many are left nowadays), So it's a possibility!

I'm sure one of the more senior programmers here can give you a more concrete answer!

Cheers for now,
Jas.

Does this mean somewhere in a .h file someone has typedefed

unsigned long PASCAL

?

Thanks.

This article has been dead for over six months. Start a new discussion instead.