* cxx include files for bsd-socket stuff
@ 1994-02-17 0:33 Emmanuel Ackaouy
1994-02-17 21:09 ` Suresh Subramanian
0 siblings, 1 reply; 2+ messages in thread
From: Emmanuel Ackaouy @ 1994-02-17 0:33 UTC (permalink / raw)
Hello...
I am having the following problem on an ALPHA 3000/400,
running OSF1 1.3:
I am using the DEC's c++ compiler: cxx, also known as
the Rush Limbaugh of C++ compilers (ultra conservative,
cannot be reasoned with, ...).
I am trying to compile C++ code which calls on
the berkeley socket routines, as well as all their
friends.(ie: socket, bind, ntohl, ...)
Yes: I am including all the right files...
However, cxx does not find definitions for the
routines/macros.
cc doesn't have any problems...
I suppose cxx uses a different set of include files.
The question is:
How do I get out of this mess, without having to
write C wrappers for all routines I am interested in?
_any_ hints, posted or mailed will be greatly appreciated.
(even from Rush fans 8-)
Mighty comfused,
--
Emmanuel Ackaouy
ack@cs.wisc.edu
^ permalink raw reply [flat|nested] 2+ messages in thread
* 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
end of thread, other threads:[~1994-02-17 21:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-02-17 0:33 cxx include files for bsd-socket stuff Emmanuel Ackaouy
1994-02-17 21:09 ` Suresh Subramanian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox