DCC version 1.2.34

Carl Stehle webmaster@instantservers.com
Wed Mar 10 22:49:20 UTC 2004


> 
> >
> > > 2. dcclib/get_port.c (dcc_get_host_ipv4)
> > > Changed:
> > >  struct hostent * WSAAPI (fnc)(const char *))
> > > to
> > >  struct hostent * (WSAAPI fnc)(const char *))
> > >
> > > Not sure what 'WSAAPI' was intended for but as it is null by
> > > default, I thought perhaps it was for this purpose.
> >
> > Are you sure that declaration needs __stdcall?
> >
> > I threw the WSAAPI because you mentioned problems nearby,
> > the WINSOCK 2 documentation seems to use WSAAPI as a particle
> > for resolving idiosyncratic linking hassles,
> > and the Borland copy of winsock2.c says
> >
> >     WINSOCK_API_LINKAGE
> >     struct hostent FAR *
> >     WSAAPI
> >     gethostbyname(
> >         const char FAR * name
> >         );
> >
> > How is gethostbyname() declared in the Microsoft SDK?
> 
> gethostbyname() is declared exactly as above.
> Also, from winsock2.h:
> #define WSAAPI                  FAR PASCAL
> 
> The documentation states that 'PASCAL' is now obsolete.
> Looks like backward compatibility to me.
> 
> But I think the problem is not in the declaration of
> gethostbyname() but rather in the declaration of 'fnc':
> the compiler appears incapable of assuming __stdcall with
> the function referenced by 'fnc' without __stdcall appearing
> in the actual argument declaration. This is the case even if
> the compiler switch which sets __stdcall as the default calling
> convention is used; I had previously thought it was possible to
> work around this with the compiler switch but other errors
> apparently masked the fact that this did not work. So, I do not
> see a way around an MSVC-specific preprocessor switch to declare
> __stdcall as the calling convention used with 'fnc'.
> 

More correctly, 'PASCAL' *is* __stdcall. Therefore, 'fnc' must be
declared similarly:
 struct hostent * (WSAAPI fnc)(const char *))
does so (with Windows supplying the definition of WSAAPI).

-- 
Carl Stehle



More information about the DCC mailing list

Contact vjs@rhyolite.com by mail or use the form.