* Re: cxx include files for bsd-socket stuff
1994-02-17 0:33 cxx include files for bsd-socket stuff Emmanuel Ackaouy
@ 1994-02-17 21:09 ` Suresh Subramanian
0 siblings, 0 replies; 2+ messages in thread
From: Suresh Subramanian @ 1994-02-17 21:09 UTC (permalink / raw)
All prototypes for all the socket calls were added in OSF/1 V2.0
As an work around (All the usual disclaimers - this info is from Digital
internal infobase and not an official Digital recommendation; yata yata ...)
Use this code with your socket functions (extended appropriately for
any other socket functions you use):
extern "C"
{
bzero(void *, int);
gethostname(char *, int);
struct servent *getservbyname(char *, char *);
struct hostent *gethostbyname(char *);
unsigned short htons(unsigned short);
unsigned int htonl(unsigned int);
/*
* socket routines
*/
accept(int, void *, int *);
bind(int, void *, int);
connect(int, void *, int);
listen(int, int);
recv(int, char *, int, int);
select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
send(int, char *, int, int);
setsockopt(int, int, int, char *, int);
shutdown(int, int);
socket(int, int, int);
}
Note that these function defs are not in socket.h, or any other
system header file, to my knowledge. I'm no language expert, but I
think that K+R C will not complain about undefined functions, and
defaults them to returning int, and the args don't matter. The
linker finds them and everything works. C++ (and strict ansi C)
will complain about undefined functions so you get compile errors.
Good Luck!
^ permalink raw reply [flat|nested] 2+ messages in thread