* C program under DEC/Alpha
@ 1998-03-21 5:00 lakha001
1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: lakha001 @ 1998-03-21 5:00 UTC (permalink / raw)
Can someone help me out with this. I am trying to write a simple C
program on DEC/Alpha system. For some reason, it just won't compile. I
am not sure what I am missing out. I looked at the HELP pages on the
system and the CC run time routines do show popen as a command.
rem The program itself.
#include <stdio.h>
void main()
{
FILE *fi;
fi = popen("PMDF MAIL", "w");
fprintf(fi, "send\n");
fprintf(fi, "lakha001@cerritos.edu\n\n");
fprintf(fi, "This is a test\n");
fprintf(fi, "Mail sent using C program\n");
fprintf(fi, "^Z\n");
pclose(new);
}
rem Compiling
$ CC/DECC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIE New.c
fi = popen("PMDF MAIL", "w");
.............^
%CC-I-IMPLICITFUNC, In this statement, the identifier "popen" is
implicitly decl
ared as a function.
at line number 6 in file FOO_BAR:[MY.LAKHA001]NEW.C;2
fi = popen("PMDF MAIL", "w");
........^
%CC-W-CVTDIFTYPES, In this statement, "popen(...)" of type "int", is
being conve
rted to "pointer to pointer to struct _iobuf".
at line number 6 in file FOO_BAR:[MY.LAKHA001]NEW.C;2
pclose(new);
........^
%CC-I-IMPLICITFUNC, In this statement, the identifier "pclose" is
implicitly dec
lared as a function.
at line number 12 in file FOO_BAR:[MY.LAKHA001]NEW.C;2
pclose(new);
...............^
%CC-E-UNDECLARED, In this statement, "new" is not declared.
at line number 12 in file FOO_BAR:[MY.LAKHA001]NEW.C;2
$
Please respond directly by mailing me back since I dont frequent the
newsgroups.
Thanks,
Mansoor.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: C program under DEC/Alpha
1998-03-21 5:00 C program under DEC/Alpha lakha001
@ 1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-22 5:00 ` lakha001
1998-03-23 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-24 5:00 ` Hoff Hoffman
1998-03-30 5:00 ` Bob Koehler
2 siblings, 2 replies; 9+ messages in thread
From: Dr Ivan D Reid, muSR Facility @ 1998-03-22 5:00 UTC (permalink / raw)
In article <351460D6.C20A915@cerritos.edu>, lakha001@cerritos.edu wrote:
>Can someone help me out with this. I am trying to write a simple C
>program on DEC/Alpha system. For some reason, it just won't compile. I
>am not sure what I am missing out. I looked at the HELP pages on the
>system and the CC run time routines do show popen as a command.
>rem The program itself.
>#include <stdio.h>
>void main()
>{
> FILE *fi;
FILE *popen();
int pclose();
/* Takes care of the assumed function types and mismatch warnings */
> fi = popen("PMDF MAIL", "w");
> fprintf(fi, "send\n");
> fprintf(fi, "lakha001@cerritos.edu\n\n");
> fprintf(fi, "This is a test\n");
> fprintf(fi, "Mail sent using C program\n");
> fprintf(fi, "^Z\n");
> pclose(new);
pclose(fi);
/* typing/transcription error there! */
>Please respond directly by mailing me back since I dont frequent the
>newsgroups.
Ask here, get an answer here...
--
Ivan Reid, Paul Scherrer Institute, CH. reid@psi.ch
Support Jayne Hitchcock: http://www.geocities.com/hollywood/6172/helpjane.htm
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: C program under DEC/Alpha
1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
@ 1998-03-22 5:00 ` lakha001
1998-03-23 5:00 ` Dr Ivan D Reid, muSR Facility
1 sibling, 0 replies; 9+ messages in thread
From: lakha001 @ 1998-03-22 5:00 UTC (permalink / raw)
To: Ivan.Reid
Aiight... I modified the program the way you said... it compiles aiight, but is
complaining about symbols when I link it.
$ type new.c
#include <stdio.h>
void main()
{
FILE *fi;
FILE *popen();
int pclose();
fi = popen("PMDF MAIL", "w");
fprintf(fi, "send\n");
fprintf(fi, "lakha001@cerritos.edu\n\n");
fprintf(fi, "This is a test\n");
fprintf(fi, "Mail sent using C program\n");
fprintf(fi, "^Z\n");
pclose(fi);
}
$ CC/DECC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIE New.c
$ link new.obj
FILE: new
%LINK-W-NUDFSYMS, 2 undefined symbols:
%LINK-I-UDFSYM, PCLOSE
%LINK-I-UDFSYM, POPEN
%LINK-W-USEUNDEF, undefined symbol POPEN referenced
in psect $LINK$ offset %X00000040
in module NEW file
FOO_BAR:[MY.LAKHA001]NEW.OBJ;3
%LINK-W-USEUNDEF, undefined symbol PCLOSE referenced
in psect $LINK$ offset %X00000090
in module NEW file
FOO_BAR:[MY.LAKHA001]NEW.OBJ;3
Thanks,
Mansoor.
PS: Please reply and post back to the newsgroup. My news reader is a pain and
it's hard for me to search and look back at any replies to my origional POST.
Dr Ivan D Reid, muSR Facility wrote:
> In article <351460D6.C20A915@cerritos.edu>, lakha001@cerritos.edu wrote:
> >Can someone help me out with this. I am trying to write a simple C
> >program on DEC/Alpha system. For some reason, it just won't compile. I
> >am not sure what I am missing out. I looked at the HELP pages on the
> >system and the CC run time routines do show popen as a command.
>
> >rem The program itself.
>
> >#include <stdio.h>
>
> >void main()
> >{
> > FILE *fi;
> FILE *popen();
> int pclose();
> /* Takes care of the assumed function types and mismatch warnings */
>
> > fi = popen("PMDF MAIL", "w");
> > fprintf(fi, "send\n");
> > fprintf(fi, "lakha001@cerritos.edu\n\n");
> > fprintf(fi, "This is a test\n");
> > fprintf(fi, "Mail sent using C program\n");
> > fprintf(fi, "^Z\n");
> > pclose(new);
> pclose(fi);
> /* typing/transcription error there! */
>
> >Please respond directly by mailing me back since I dont frequent the
> >newsgroups.
>
> Ask here, get an answer here...
>
> --
> Ivan Reid, Paul Scherrer Institute, CH. reid@psi.ch
> Support Jayne Hitchcock: http://www.geocities.com/hollywood/6172/helpjane.htm
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: C program under DEC/Alpha
1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-22 5:00 ` lakha001
@ 1998-03-23 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-23 5:00 ` Greg Thomas
1 sibling, 1 reply; 9+ messages in thread
From: Dr Ivan D Reid, muSR Facility @ 1998-03-23 5:00 UTC (permalink / raw)
In article <slrn6hajbe.g202q5.reid@PSW086.PSI.CH>,
Dr Ivan D Reid, muSR Facility wrote:
>In article <351460D6.C20A915@cerritos.edu>, lakha001@cerritos.edu wrote:
>>Can someone help me out with this. I am trying to write a simple C
>>program on DEC/Alpha system. For some reason, it just won't compile. I
>>am not sure what I am missing out. I looked at the HELP pages on the
>>system and the CC run time routines do show popen as a command.
I've had further contact from Mansoor. My suggestions allowed him
to get the programme to compile but it now won't link, due to undefined
references popen and pclose. Further investigation showed:
a) the following conditional definitions within stdio.h
#if _POSIX_C_SOURCE >= 2 || !defined(_ANSI_C_SOURCE) && __CRTL_VER >= 70000000
__FILE_ptr32 popen(const char *__command, const char *__mode);
int pclose(FILE *__stream);
#endif
b) entries for decc$popen and decc$pclose in SYS$COMMON:[SYSLIB]DECC$CRTL.OLB
Since I'm running under OpenVMS V6.2, the conditional definitions
aren't executed. However, manually inserting them into the test programme
and using the flag /prefix=all still fails to cure the linking problem.
Could someone with more experience of modern DEC C comment further?
--
Ivan Reid, Paul Scherrer Institute, CH. reid@psi.ch
Support Jayne Hitchcock: http://www.geocities.com/hollywood/6172/helpjane.htm
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: C program under DEC/Alpha
1998-03-23 5:00 ` Dr Ivan D Reid, muSR Facility
@ 1998-03-23 5:00 ` Greg Thomas
1998-03-23 5:00 ` lakha001
0 siblings, 1 reply; 9+ messages in thread
From: Greg Thomas @ 1998-03-23 5:00 UTC (permalink / raw)
On 23 Mar 1998 08:43:53 GMT, reid@psi.ch (Dr Ivan D Reid, muSR
Facility) wrote in article <slrn6hcbmm.g202q5.reid@PSW086.PSI.CH>:
...
>a) the following conditional definitions within stdio.h
>#if _POSIX_C_SOURCE >= 2 || !defined(_ANSI_C_SOURCE) && __CRTL_VER >= 70000000
...
> Since I'm running under OpenVMS V6.2, the conditional definitions
>aren't executed. However, manually inserting them into the test programme
>and using the flag /prefix=all still fails to cure the linking problem.
>Could someone with more experience of modern DEC C comment further?
Without knowing what the linker errors were, it is difficult to say.
However, there is probably a good reason for the
"__CRTL_VER >= 70000000" - perhaps the routines you are calling are
only supported with a post-7.0 DEC C RTL?
If so, you may want to look into something called the 'Backport'
library which comes with the later versions of the compiler. AIUI, it
allows you to use post-7.0 DEC C RTL functions with pre-OpenVMS 7.0 -
though I'm not sure of the details.
Greg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: C program under DEC/Alpha
1998-03-23 5:00 ` Greg Thomas
@ 1998-03-23 5:00 ` lakha001
1998-03-24 5:00 ` Greg Thomas
0 siblings, 1 reply; 9+ messages in thread
From: lakha001 @ 1998-03-23 5:00 UTC (permalink / raw)
To: Greg Thomas
I really appreciate all you guys helping me out with this problem.
Here is a little bit more info on what kind of system I am working on and such...
+++++++++++++++++++++++++++++
DEC C V5.6 for OpenVMS Alpha
To compile the program I'm using the following command line
$ CC/DECC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIE
The help pages for CC show that the following Object Library are being compiled if
the above command line is used.
o Object library included in STARLET.OLB
o VAXCRTL.OLB
o VAXCRTLD.OLB
o VAXCRTLT.OLB
o VAXCCURSE.OLB
The help pages for popen look like this...
CC
Run-time_functions
popen
Initiates a pipe to a process.
Syntax:
#include <stdio.h>
FILE *popen (const char *command, const char *type);
As you can see the only header file it's requiring is stdio.h.
The program itself
$ type new.c
#include <stdio.h>
void main()
{
FILE *fi;
FILE *popen();
int pclose();
fi = popen("PMDF MAIL", "w");
fprintf(fi, "send\n");
fprintf(fi, "lakha001@cerritos.edu\n\n");
fprintf(fi, "This is a test\n");
fprintf(fi, "Mail sent using C program\n");
fprintf(fi, "^Z\n");
pclose(fi);
}
$ CC/DECC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIE
$ link new
%LINK-W-NUDFSYMS, 2 undefined symbols:
%LINK-I-UDFSYM, PCLOSE
%LINK-I-UDFSYM, POPEN
%LINK-W-USEUNDEF, undefined symbol POPEN referenced
in psect $LINK$ offset %X00000040
in module NEW file INST_DISK:[STUDENT_LA.LAKHA001.MAILC]NEW.OBJ;7
%LINK-W-USEUNDEF, undefined symbol PCLOSE referenced
in psect $LINK$ offset %X00000090
in module NEW file INST_DISK:[STUDENT_LA.LAKHA001.MAILC]NEW.OBJ;7
$
Greg Thomas wrote:
> On 23 Mar 1998 08:43:53 GMT, reid@psi.ch (Dr Ivan D Reid, muSR
> Facility) wrote in article <slrn6hcbmm.g202q5.reid@PSW086.PSI.CH>:
> ...
> >a) the following conditional definitions within stdio.h
> >#if _POSIX_C_SOURCE >= 2 || !defined(_ANSI_C_SOURCE) && __CRTL_VER >= 70000000
> ...
> > Since I'm running under OpenVMS V6.2, the conditional definitions
> >aren't executed. However, manually inserting them into the test programme
> >and using the flag /prefix=all still fails to cure the linking problem.
> >Could someone with more experience of modern DEC C comment further?
>
> Without knowing what the linker errors were, it is difficult to say.
> However, there is probably a good reason for the
> "__CRTL_VER >= 70000000" - perhaps the routines you are calling are
> only supported with a post-7.0 DEC C RTL?
>
> If so, you may want to look into something called the 'Backport'
> library which comes with the later versions of the compiler. AIUI, it
> allows you to use post-7.0 DEC C RTL functions with pre-OpenVMS 7.0 -
> though I'm not sure of the details.
>
> Greg
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: C program under DEC/Alpha
1998-03-23 5:00 ` lakha001
@ 1998-03-24 5:00 ` Greg Thomas
0 siblings, 0 replies; 9+ messages in thread
From: Greg Thomas @ 1998-03-24 5:00 UTC (permalink / raw)
On Mon, 23 Mar 1998 14:38:07 -0800, lakha001@cerritos.edu wrote in
article <3516E446.7BE54EF0@cerritos.edu>:
>I really appreciate all you guys helping me out with this problem.
>Here is a little bit more info on what kind of system I am working on and such...
...
>DEC C V5.6 for OpenVMS Alpha
...
On what version? OpenVMS Alpha 6.1, 6.2, 7.0, 7.1?
The first line of the display from
$ show system
will tell you.
Greg
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: C program under DEC/Alpha
1998-03-21 5:00 C program under DEC/Alpha lakha001
1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
@ 1998-03-24 5:00 ` Hoff Hoffman
1998-03-30 5:00 ` Bob Koehler
2 siblings, 0 replies; 9+ messages in thread
From: Hoff Hoffman @ 1998-03-24 5:00 UTC (permalink / raw)
In article <351460D6.C20A915@cerritos.edu>, lakha001@cerritos.edu writes:
:Can someone help me out with this.
It would help if you listed the operating system -- based on the
error messages, this system is clearly running OpenVMS -- and the
version of OpenVMS and (in this case) the C compiler. And for
OpenVMS questions, posting in comp.os.vms is a better choice.
: I am trying to write a simple C
:program on DEC/Alpha system. For some reason, it just won't compile. I
:am not sure what I am missing out. I looked at the HELP pages on the
:system and the CC run time routines do show popen as a command.
With DEC C, one often sees the use of the /PREFIX=ALL qualifier,
to force the routines to be prefixed for the LINK. (There is some
magic going on here, for now it is best to simply add "/PREFIX=ALL"
to the DEC C compiler incantation. It's rather easier to explain
this as "magic", by the way. :-)
Also note that the popen() and similar calls were added in the DEC C
run-time support in OpenVMS V7.0 and later. To use these calls on
versions of OpenVMS prior to V7.0, one needs to avail ones self of the
DEC C V5.6 and later "backport" library, as described in the DEC C
documentation set. (To see the current OpenVMS version, look at the
first line of the output from a SHOW SYSTEM command.)
There exists callable mail interface in OpenVMS, see the OpenVMS
Utility Routines Reference Manual for details.
Prior to this release, I would expect one would need to use a single
line such as the following:
system("MAIL filespec user/subject=\"subjecttext\" " );
I'm not sure that PMDF will work this way, but MAIL does...
Or one could use mailboxes, and pass the commands into the
subprocess one at a time, specifying the mailbox as the input
device for a lib$spawn() command, or via a system() call with
the command specification of "@mbxdevname:". Remember to send
along a ^Z (EOF, <CTRL/Z>) or EXIT as the last command...
Or one could use a text file, and execute it via @filespec,
via a call to lib$spawn() or via system().
:Please respond directly by mailing me back since I dont frequent the
:newsgroups.
Ask here, get an answer here.
-------------------------- pure personal opinion ---------------------------
Hoff (Stephen) Hoffman OpenVMS Engineering hoffman@xdelta.ZZenet.dec.com
note to those folks not contributing spam -- there is no ZZ in my address
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: C program under DEC/Alpha
1998-03-21 5:00 C program under DEC/Alpha lakha001
1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-24 5:00 ` Hoff Hoffman
@ 1998-03-30 5:00 ` Bob Koehler
2 siblings, 0 replies; 9+ messages in thread
From: Bob Koehler @ 1998-03-30 5:00 UTC (permalink / raw)
In article <351460D6.C20A915@cerritos.edu>, lakha001@cerritos.edu writes:
>Can someone help me out with this. I am trying to write a simple C
>program on DEC/Alpha system. For some reason, it just won't compile. I
>am not sure what I am missing out. I looked at the HELP pages on the
>system and the CC run time routines do show popen as a command.
>
>$ CC/DECC/PREFIX_LIBRARY_ENTRIES=ALL_ENTRIE New.c
>
> fi = popen("PMDF MAIL", "w");
>.............^
>%CC-I-IMPLICITFUNC, In this statement, the identifier "popen" is
>implicitly decl
>ared as a function.
>at line number 6 in file FOO_BAR:[MY.LAKHA001]NEW.C;2
>
You need a later version of VMS. popen is new for VMS 7.0, and stdio.h knows
that. If you're using a 6.x you may be able to use the "backport" kit which
gets you the new C library for older vesions than 7.0. stdio.h may or may not
be updated by the backport kit, you'll have to check (only the copy in
sys$library:decc$rtldef.tlb is actually used).
------------------------------------------------------------------------------
Bob Koehler | Computer Sciences Corporation
Hubble Space Telescope Payload | System Sciences Division
Flight Software Team | please remove ".aspm" when replying
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1998-03-30 5:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-03-21 5:00 C program under DEC/Alpha lakha001
1998-03-22 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-22 5:00 ` lakha001
1998-03-23 5:00 ` Dr Ivan D Reid, muSR Facility
1998-03-23 5:00 ` Greg Thomas
1998-03-23 5:00 ` lakha001
1998-03-24 5:00 ` Greg Thomas
1998-03-24 5:00 ` Hoff Hoffman
1998-03-30 5:00 ` Bob Koehler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox