On Jan 23, 2007, at 6:11 PM, Dave Jones wrote:
I know that this is the z/VM forum, but I have a question about
compiling a C program on CMS, so I'm hoping someone here might know
the answer.....
I've written a short C test program that invokes the new
"getaddrinfo" C library function. However, the z/VM C/C++ compiler
complains with the following error message when I attempt to
compile my test program:
#define _OPEN_SYS_SOCK_IPV6
#include <netdb.h>
#include <sys/socket.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
struct addrinfo hints, *res, *res0; int
main(int argc, char *argv )
{ int
error; int
s; char
*name = "www.cacert.org"; char
*port = "80"; const
char *cause =
NULL;
memset(&hints, 0, sizeof
(hints)); hints.ai_family =
PF_UNSPEC; hints.ai_socktype =
SOCK_STREAM; error = getaddrinfo
(name, port, &hints,
&res0); ...................a......................................
....
=====> a - CCN3023 Expecting function or pointer to function.
Can anyone tell me what I'm doing wrong (besides the obvious fact
that I am reduced to using C as a programming language, which has
to be one of the worst tools ever devised..the use of C has set
back good software development by 20 years, imho.)
I think passing the address of hints with & is a C++ism.
You mean memset(hints,0,sizeof(hints)), I think.
Likewise, getaddrinfo(name, port, hints, res0)
Adam