Thanks to the help and advice of the good folks on this list, I have
managed to solve my C compiler problem. Turns out that I need to do a
#define _NO_NEW_FUNC_CHECK
at the beginning of the code. That tells the C compler (C/C++ for z/VM,
btw) to actually include the correct code to invoked the "getaddrinfo"
function, instead of generating a dummy external structure with the name
of "getaddrinfo". The dummy structure was the actual source of the error
message the C compiler produced.
Unfortunately, the _NO_NEW_FUNC_CHECK directive is not documented
anywhere in either the C or LE manuals, and I don't have a warm fuzzy
feeling about having to use it. Maybe some one from C or LE development
can add to my understanding of why it's there and what it's meant to do...
The good news is that the code now compiles, loads and runs as I expect
it to.
Thanks again, and have a good one.
DJ
William Moy wrote:
Hi Dave,
Have you tried c89? I cut and paste your code and compiled with
c89 successfully. Here is screenshot.
Best Regards,
Bill Moy
----- Forwarded by William Moy/Endicott/IBM on 01/24/2007 11:08 AM -----
*Dave Jones <[EMAIL PROTECTED]>*
Sent by: The IBM z/VM Operating System
<IBMVM@LISTSERV.UARK.EDU>
01/23/2007 07:11 PM
Please respond to
The IBM z/VM Operating System
<IBMVM@LISTSERV.UARK.EDU>
To
IBMVM@LISTSERV.UARK.EDU
cc
Subject
a C language question....
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.)
Thanks for any help and have a good one.
DJ