📄 c89.html
字号:
in<i><a href="../xsh/unistd.h.html"><unistd.h></a></i>and those functions marked as an RT extension in<i><a href="../xsh/sysmman.h.html"><sys/mman.h></a></i>and<i><a href="../xsh/time.h.html"><time.h></a></i>.This operand is not required to be present to cause a searchof this library.<dt><b>-l l</b><dd>This operand makes visible all functions required by the C-language output of<i><a href="lex.html">lex</a></i>that are not made available through the<b>-l c</b>operand.<dt><b>-l pthread</b><dd>This operand makes visible all functions referenced in<i><a href="../xsh/pthread.h.html"><pthread.h></a></i>and<i><a href="../xsh/pthread_atfork.html">pthread_atfork()</a></i>referenced in<i><a href="../xsh/unistd.h.html"><unistd.h></a></i>.An implementation may search this library in the absence of thisoperand.<dt><b>-l m</b><dd>This operand makes visible all functions referenced in<i><a href="../xsh/math.h.html"><math.h></a></i>.An implementation may search this library in the absence of this operand.<dt><b>-l rt</b><dd>This operand makes visible all functions referenced in<i><a href="../xsh/aio.h.html"><aio.h></a></i>,<i><a href="../xsh/mqueue.h.html"><mqueue.h></a></i>,<i><a href="../xsh/sched.h.html"><sched.h></a></i>and<i><a href="../xsh/semaphore.h.html"><semaphore.h></a></i>,and those functions marked as an RT extension in<i><a href="../xsh/sysmman.h.html"><sys/mman.h></a></i>and<i><a href="../xsh/time.h.html"><time.h></a></i>.An implementation may search this library in the absence of thisoperand.<dt><b>-l y</b><dd>This operand makes visible all functions required by the C-language output of<i><a href="yacc.html">yacc</a></i>that are not made available through the<b>-l c</b>operand.</dl><p>In the absence of options that inhibit invocationof the link editor, such as<b>-c</b>or<b>-E</b>,the<i>c89</i>utility will cause the equivalent of a<b>-l c</b>operand to be passed to the link editor as the last<b>-l</b>operand, causing it to be searched after all other object filesand libraries are loaded.<p>It is unspecified whether the libraries<b>libc.a</b>,<b>libm.a</b>,<b>librt.a</b>,<b>libpthread.a</b>,<b>libl.a</b>or<b>liby.a</b>exist as regular files.The implementation may accept as<b>-l</b>operands names of objects that do not exist as regular files.<p><h5><a name = "tag_000_000_203_002"> </a>External Symbols</h5>The C compiler and link editorsupport the significance of external symbols up to alength of at least 31 bytes;the action taken upon encounteringsymbols exceeding the implementation-dependentmaximum symbol length is unspecified.<p>The compiler and link editorsupport a minimum of 511 externalsymbols per source or object file,and a minimum of 4095 external symbols in total.A diagnostic message will be written to the standard outputif the implementation-dependent limit is exceeded;other actions are unspecified.<h5><a name = "tag_000_000_203_003"> </a>Programming Environments</h5><p>All implementations will support one of the following programmingenvironments as a default.Implementations may support more than one of the following programmingenvironments.Applications can use<i><a href="../xsh/sysconf.html">sysconf()</a></i>or<i><a href="getconf.html">getconf</a></i>to determine which programming environments are supported.<pre><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Programming Environment<br><i>getconf</i> Name</b><th align=center><b>Bits in<br> int</b><th align=center><b>Bits in<br> long</b><th align=center><b>Bits in<br> pointer</b><th align=center><b>Bits in<br> off_t</b><tr valign=top><td align=left>_XBS5_ILP32_OFF32<td align=left>32<td align=left>32<td align=left>32<td align=left>32<tr valign=top><td align=left>_XBS5_ILP32_OFFBIG<td align=left>32<td align=left>32<td align=left>32<td align=left>>= 64<tr valign=top><td align=left>_XBS5_LP64_OFF64<td align=left>32<td align=left>64<td align=left>64<td align=left>64<tr valign=top><td align=left>_XBS5_LPBIG_OFFBIG<td align=left>>= 32<td align=left>>= 64<td align=left>>= 64<td align=left>>= 64</table></pre><h6 align=center><xref table="Programming Environments - Type Sizes"><a name="tagt_1"> </a></xref>Table: Programming Environments - Type Sizes</h6><p>Implementations provide configuration strings for C compiler flags,linker/loader flags and libraries for each supported environment.When an application needs to use a specific programming environmentrather than the implementation default programming environment whilecompiling, the application must first verify that the implementationsupports the desired environment.If the desired programming environment is supported, the applicationmust then invoke<i>c89</i>with the appropriate C compiler flags as the first options for thecompile, the appropriate linker/loader flags after any other optionsbut before any operands, and the appropriate libraries at the end ofthe operands.<p>Portable applications must not attempt to link together object filescompiled for different programming models.Applications must also be aware that binary data placed in sharedmemory or in files might not be recognised by applications built forother programming models.<pre><table bordercolor=#000000 border=1 align=center><tr valign=top><th align=center><b>Programming Environment<br><i>getconf</i> Name</b><th align=center><b>Use</b><th align=center><b><i>c89</i> and <i>cc</i> Arguments<br><i>getconf</i> Name</b><tr valign=top><td align=left>_XBS5_ILP32_OFF32<td align=left>C Compiler Flags<td align=left>XBS5_ILP32_OFF32_CFLAGS<tr valign=top><td align=left> <td align=left>Linker/Loader Flags<td align=left>XBS5_ILP32_OFF32_LDFLAGS<tr valign=top><td align=left> <td align=left>Libraries<td align=left>XBS5_ILP32_OFF32_LIBS<tr valign=top><td align=left>_XBS5_ILP32_OFFBIG<td align=left>C Compiler Flags<td align=left>XBS5_ILP32_OFFBIG_CFLAGS<tr valign=top><td align=left> <td align=left>Linker/Loader Flags<td align=left>XBS5_ILP32_OFFBIG_LDFLAGS<tr valign=top><td align=left> <td align=left>Libraries<td align=left>XBS5_ILP32_OFFBIG_LIBS<tr valign=top><td align=left>_XBS5_LP64_OFF64<td align=left>C Compiler Flags<td align=left>XBS5_LP64_OFF64_CFLAGS<tr valign=top><td align=left> <td align=left>Linker/Loader Flags<td align=left>XBS5_LP64_OFF64_LDFLAGS<tr valign=top><td align=left> <td align=left>Libraries<td align=left>XBS5_LP64_OFF64_LIBS<tr valign=top><td align=left>_XBS5_LPBIG_OFFBIG<td align=left>C Compiler Flags<td align=left>XBS5_LPBIG_OFFBIG_CFLAGS<tr valign=top><td align=left> <td align=left>Linker/Loader Flags<td align=left>XBS5_LPBIG_OFFBIG_LDFLAGS<tr valign=top><td align=left> <td align=left>Libraries<td align=left>XBS5_LPBIG_OFFBIG_LIBS</table></pre><h6 align=center><xref table="Programming Environments - <I>c89</i> and <i>cc</i> Arguments"></xref>Table: Programming Environments - <i>c89</i> and <i>cc</i> Arguments</h6></blockquote><h4><a name = "tag_000_000_204"> </a>EXIT STATUS</h4><blockquote>The following exit values are returned:<dl compact><dt>0<dd>Successful compilation or link edit.<dt>>0<dd>An error occurred.</dl></blockquote><h4><a name = "tag_000_000_205"> </a>CONSEQUENCES OF ERRORS</h4><blockquote>When<i>c89</i>encounters a compilation error that causes an object file not tobe created, it will write a diagnostic to standard errorand continue to compile other source code operands, but itwill not perform the link phase and will return a non-zero exit status.If the link edit is unsuccessful,a diagnostic message will be written to standard error and<i>c89</i>will exit with a non-zero status.A portable application must rely on the exit status of<i>c89</i>,rather than on the existence or mode of the executable file.</blockquote><h4><a name = "tag_000_000_206"> </a>APPLICATION USAGE</h4><blockquote>Since the<i>c89</i>utilityusually creates files in the currentdirectory during the compilation process, it is typicallynecessary to run the<i>c89</i>utilityin a directory in which a file can be created.<p>On systems conforming to the ISO/IEC 9945-2:1993 standard,<i>c89</i>may be provided only as part of the C-Language Development Option;XSI-conformant systems always provide<i>c89</i>.<p>Some historical implementations have created<b>.o</b>files when<b>-c</b>is not specified and more than one source file is given.Since this area is left unspecified, the application cannotrely on<b>.o</b>files being created, but it also must be preparedfor any related<b>.o</b>files that already exist being deleted at thecompletion of the link edit.<p>Some historical implementations have permitted<b>-L</b>options to be interspersed with<b>-l</b>operands on the command line.For an application to compile consistently on systemsthat do not behave like this, it is necessary for aportable application to supply all<b>-L</b>options beforeany of the<b>-l</b>options.<p>There is the possible implication that if a user supplies versionsof the standard library functions (before they would be encounteredby an implicit<b>-l c</b>or explicit<b>-l m</b>),that those versions wouldbe used in place of the standard versions.There are various reasonsthis might not be true (functions defined as macros, manipulationsfor clean name space, and so on), so the existence of files namedin the same manner as the standard libraries within the<b>-L</b>directories is explicitly stated to produce unspecified behaviour.<p>All of the interfaces specified in the <b>XSH</b> specification may be made visible byimplementations when the Standard C Library is searched.Portable applications must explicitly request searching the otherstandard libraries when functions made visible by thoselibraries are used.<p>An application strictly portable to the ISO/IEC 9945-2:1993 standard cannot rely on<i>TMPDIR</i>overriding the default temporary directory.On XSI-conformant systems, however, this will always be the case.</blockquote><h4><a name = "tag_000_000_207"> </a>EXAMPLES</h4><blockquote>The following are examples of usage:<dl compact><dt>c89 -o foo foo.c<dd>Compiles<b>foo.c</b>and creates the executable file<b>foo</b>.<dt>c89 -c foo.c<dd>Compiles<b>foo.c</b>and creates the object file<b>foo.o</b>.<dt>c89 foo.c<dd>Compiles<b>foo.c</b>and creates the executable file<b>a.out</b>.<dt>c89 foo.c bar.o<dd>Compiles<b>foo.c</b>links it with<b>bar.o</b>,and creates theexecutable file<b>a.out</b>.Also creates and leaves<b>foo.o</b>.</dl><p>The following example shows how an application using threadsinterfaces can test for support of and use a programming environmentsupporting 32-bit <b>int</b>,<b>long</b>and<b>pointer</b>types and an<b>off_t</b>type using at least 64 bits:<pre><code>if [ $(getconf _XBS5_ILP32_OFFBIG) != "-1" ]then c89 $(getconf XBS5_ILP32_OFFBIG_CFLAGS) -D_XOPEN_SOURCE=500 \ $(getconf XBS5_ILP32_OFFBIG_LDFLAGS) foo.c -o foo \ $(getconf XBS5_ILP32_OFFBIG_LIBS) -l pthreadelse echo ILP32_OFFBIG programming environment not supported exit 1fi</code></pre><p>The following examples clarify the use and interactions of<b>-L</b>options and<b>-l</b>operands:<ol><p><li>Consider the case in which module<b>a.c</b>calls function<i>f()</i>in library<b>libQ.a</b>,and module<b>b.c</b>calls function<i>g()</i>in library<b>libp.a</b>.Assume that both libraries reside in<b>/a/b/c</b>.The commandline to compile and link in the desired way is:<pre><code>c89 -L /a/b/c main.o a.c -l Q b.c -l p</code></pre>In this case the<b>-l Q</b>operand need only precede the first<b>-l p</b>operand, since both<b>libQ.a</b>andlibp.areside in the same directory.<br><p><li>Multiple<b>-L</b>operands can be used when library name collisions occur.Building on the previous example,suppose that the user wants to use a new<b>libp.a</b>,in<b>/a/a/a</b>,but still wants<i>f()</i>from<b>/a/b/c/libQ.a</b>:<pre><code>c89 -L /a/a/a -L /a/b/c main.o a.c -l Q b.c -l p</code></pre><p>In this example,the linker searches the<b>-L</b>options in the order specified,and finds<b>/a/a/a/libp.a</b>before<b>/a/b/c/libp.a</b>when resolving references for<b>b.c</b>.The order of the<b>-l</b>operands is still important, however.<p></ol></blockquote><h4><a name = "tag_000_000_208"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_000_209"> </a>SEE ALSO</h4><blockquote><i><a href="ar.html">ar</a></i>,<i><a href="cc.html">cc</a></i>,<i><a href="getconf.html">getconf</a></i>,<i><a href="make.html">make</a></i>,<i><a href="nm.html">nm</a></i>,<i><a href="strip.html">strip</a></i>,the <b>XSH</b> specification description of<i><a href="../xsh/sysconf.html">sysconf()</a></i>,<i><a href="umask.html">umask</a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -