[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: windows build needs gethostname ?
From: |
Conrad T. Pino |
Subject: |
RE: windows build needs gethostname ? |
Date: |
Tue, 30 Nov 2004 20:16:39 -0800 |
> From: Derek Robert Price
>
> The prototype that our Windows developer is using as a workaround is:
>
> int __stdcall gethostname (char * name, int namelen);
>
> Don't know why the "int gethostname (char * name, int namelen);" decl
> wouldn't work.
The reason is all functions implemented as Windows native API functions
use the "__stdcall" function calling convention and therefore require
the Windows #include file with the correct declaration or equivalent.
The maintenance of "equivalents" becomes a problem so using the Windows
#include file is really the best technical solution.
Keywords "__stdcall" and C default "__cdecl" set the calling conventions
which include altering the compiler's behavior for:
Argument-passing order
Stack-maintenance responsibility
Name-decoration convention
Case-translation convention
and the details are here:
http://msdn.microsoft.com/library/en-us/dv_vccelng4/html/ellrfususstdcall.asp
http://msdn.microsoft.com/library/en-us/dv_vccelng4/html/ellrfususcdecl.asp
Conrad