VMS pointer problems continue.
Mike Ayers
V053MF43 at ubvmsc.cc.buffalo.EDU
Thu Mar 24 12:54:07 AEST 1988
No one gave me a solution last time, so here I am again to state the
problem a little more clearly. Thanks to a new utility, you can see firsthand
the kind of frustration I'm getting here:
===============================================================================
$type q.c
char *wr(a)
int a;
{
char b = "Arf!";
return(b);
}
main()
{
printf(" %s ",wr(4));
}
$cc q
$link q,sys$share:vaxcrtl-options-file/opt
$run q
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=00000000,u[MF|L PC
=00005438, PSL=0BC00005
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name routine name line rel PC abs PC
00005438 00005438
00002EC8 00002EC8
Q main 11 00000027 00000437
$type sys$share:vaxcrtl-options-file.opt
Sys$Share:Vaxcrtl.Exe/Share
===============================================================================
I am certain that this code is perfectly legal within K&R syntax rules.
The error here seems to be that I am linking the wrong way. I am under VMS
4.7, and all the C linking rules have been changed. If anyone knows what I am
doing wrong here (I am trying simply to get my function to return a pointer to
the first character in a string - the function declaration I am using is the
same style K&R used for their fgets) PLEASE let me know - this is getting
downright aggravating.
By the way, this code was ported to Turbo C where it also refused to
compile properly - the best I've gotten under any system was the same garbage
every time I run it. Has someone changed all the declaration standards while I
wasn't looking?
Me again . . . Mike Ayers /|___/|
/ , _ |
INTERNET: V053MF43 at UBVMS.BITNET or | O O /
V053MF43 at UBVMS.CC.BUFFALO.EDU / /
SNAILNET: 190 Minnesota Ave. |\ / ARF!
Buffalo, NY 14214 ---
BELLNET : (716)838-3696 U
"I am a jelly doughnut."
- John F. Kennedy
More information about the Comp.lang.c
mailing list