[Info-vax] ANSI89 C and Sleep function

Joseph Huber joseph.huber at NOREPLY.web.de
Thu Dec 8 05:56:52 EST 2011


GerMarsh wrote:
> I have to use the /STANDARD=ANSI89 qualifier to compile a C program
> with the sleep() funtion in it.
> 
> I have found the function def in a header file:  #include <unistd.h>
> but the link fails with:
> %LINK-W-NUDFSYMS, 1 undefined symbol:
> %LINK-I-UDFSYM,         SLEEP
> %LINK-W-USEUNDEF, undefined symbol SLEEP referenced
>         in psect $LINK$ offset %X00000180

Add a /PREFIX=all to the CC command:
cc/STANDARD=ANSI89/prefix=all
For /STANDARD=ANSI89, the default is /PREFIX=ANSI_C89_ENTRIES,
I'm not familiar enough with the standards, but maybe sleep is not part of 
ANSI C89  (it is a Unix/Posix standard). 

 
> If I remove the /STANDARD qualifier, I don't need the header file and
> the link is ok. Anyone know where the object code for that sleep
> function lives so I can include it in the link?

Are You sure ? Doesn't the C compiler complain about an undeclared name 
"sleep" ?
Maybe unistd is implicitly included by some other includes ?
 
> I've looked in both user and ref manuals but cannot glean anything
> from them.

decc$sleep is in decc$shr.exe and DECC$CRTL.OLB.
Without /prefix, the object file would contain a reference to sleep, not 
decc$sleep.

SLEEP is also in VAXCRTL, but depending on VMS and C compiler version, this 
may or may not work correctly.
 
-- 

Remove NOREPLY. from Email address.
Joseph Huber, http://www.huber-joseph.de



More information about the Info-vax mailing list