isposix

Un outil pour savoir si une commande est posix - retour accueil

git clone git://bebou.netlib.re/isposix
Log | Files | Refs | README |

c17.html (61794B)


      1 <!-- Copyright 2001-2024 IEEE and The Open Group, All Rights Reserved -->
      2 <!DOCTYPE HTML>
      3 <html lang="en">
      4 <head>
      5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.8.0">
      6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      7 <link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group rhtm tool v1.2.4 -->
      8 <!-- Copyright (c) 2001-2024 The Open Group, All Rights Reserved -->
      9 <title>c17</title>
     10 </head>
     11 <body bgcolor="white">
     12 <div class="NAVHEADER">
     13 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
     14 <tr class="nav">
     15 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/bg.html" accesskey="P">&lt;&lt;&lt;
     16 Previous</a></td>
     17 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
     18 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/cal.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
     19 </tr>
     20 </table>
     21 <hr align="left" width="100%"></div>
     22 <script language="JavaScript" src="../jscript/codes.js"></script><basefont size="3">
     23 <center><font size="2">The Open Group Base Specifications Issue 8<br>
     24 IEEE Std 1003.1-2024<br>
     25 Copyright © 2001-2024 The IEEE and The Open Group</font></center>
     26 <hr size="2" noshade>
     27 <a name="top" id="top"></a> <a name="c17" id="c17"></a> <a name="tag_20_11" id="tag_20_11"></a><!-- c17 -->
     28 <h4 class="mansect"><a name="tag_20_11_01" id="tag_20_11_01"></a>NAME</h4>
     29 <blockquote>c17 — compile standard C programs</blockquote>
     30 <h4 class="mansect"><a name="tag_20_11_02" id="tag_20_11_02"></a>SYNOPSIS</h4>
     31 <blockquote class="synopsis">
     32 <div class="box"><code><tt><sup>[<a href="javascript:open_code('CD')">CD</a>]</sup> <img src="../images/opt-start.gif" alt=
     33 "[Option Start]" border="0"> c17</tt> <b>[</b><i>options</i><tt>...</tt><b>]</b> <i>pathname</i> <b>[[</b><i>pathname</i><b>]
     34 [</b><tt>-I</tt> <i>directory</i><b>]<br></b> <tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt> <b>[</b><tt>-L</tt>
     35 <i>directory</i><b>] [</b><tt>-l</tt> <i>library</i><b>] [</b><tt>-R</tt> <i>directory</i><b>]]</b><tt>... <img src=
     36 "../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
     37 </blockquote>
     38 <h4 class="mansect"><a name="tag_20_11_03" id="tag_20_11_03"></a>DESCRIPTION</h4>
     39 <blockquote>
     40 <p>The <i>c17</i> utility is an interface to the standard C compilation system; it shall accept source code written in the C
     41 language as defined in section 6 of the ISO&nbsp;C standard. The system conceptually consists of a compilation phase, encompassing
     42 Translation Phases 1 through 7 of the ISO&nbsp;C standard, and a linkage phase, for handling Phase 8 of the ISO&nbsp;C standard and
     43 extensions described here. The reference to &quot;library components&quot; in Phase 8 shall be taken to refer to components of libraries
     44 specified using the <b>-l</b> option, libraries specified as <i>file</i><b>.a</b> or <i>file</i><b>.so</b> operands, and the
     45 equivalent of a <b>-l c</b> option passed to the link editor in the manner specified in the EXTENDED DESCRIPTION. In addition, the
     46 compilation phase can be split into a separate preprocessing operation, handling Translation Phases 1 through 4, and a processing
     47 operation, handling Phases 5 though 7. Whether a single utility or multiple utilities for handling phases separately is provided by
     48 an implementation is left unspecified. The input files referenced by <i>pathname</i> operands and <b>-l</b> option-arguments shall
     49 be compiled and linked to produce an executable file or, if the <b>-G</b> option is specified, a shared library file. It is
     50 unspecified whether the linking of an executable file occurs entirely within the operation of <i>c17</i>; when a <i>pathname</i>
     51 operand or <b>-l</b> option-argument names a shared library, an executable object may be produced that is not fully resolved until
     52 the file is executed.</p>
     53 <p>If the <b>-c</b> option is specified and the <b>-o</b> option is not specified, for all <i>pathname</i> operands of the form
     54 <i>file</i><b>.c</b> or <i>file</i><b>.i</b>, the files:</p>
     55 <pre>
     56 <tt>$(basename </tt><i>pathname</i><tt> .c).o
     57 </tt></pre>
     58 <p>or</p>
     59 <pre>
     60 <tt>$(basename </tt><i>pathname</i><tt> .i).o
     61 </tt></pre>
     62 <p>respectively shall be created as the result of successful compilation. If the <b>-c</b> option is not specified, it is
     63 unspecified whether such <b>.o</b> files are created or deleted for the <i>file</i><b>.c</b> and <i>file</i><b>.i</b> operands.</p>
     64 <p>If there are no options that prevent link editing (such as <b>-c</b> or <b>-E</b>), and all input files compile and link without
     65 error, the resulting executable file or shared library file shall be written according to the <b>-o</b> <i>outfile</i> option, if
     66 present. If <b>-o</b> <i>outfile</i> is not specified, a resulting executable file shall be written to the file <b>a.out</b>; if
     67 the file to be written is a shared library file, the behavior is unspecified.</p>
     68 <p>Executable files shall be created as specified in <a href="../utilities/V3_chap01.html#tag_18_01_01_04"><i>1.1.1.4 File Read,
     69 Write, and Creation</i></a> , except that the file permission bits shall be set to: S_IRWXO | S_IRWXG | S_IRWXU</p>
     70 <p>and the bits specified by the <a href="../utilities/umask.html"><i>umask</i></a> of the process shall be cleared.</p>
     71 </blockquote>
     72 <h4 class="mansect"><a name="tag_20_11_04" id="tag_20_11_04"></a>OPTIONS</h4>
     73 <blockquote>
     74 <p>The <i>c17</i> utility shall conform to XBD <a href="../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax
     75 Guidelines</i></a> , except that:</p>
     76 <ul>
     77 <li>
     78 <p>Options can be interspersed with operands.</p>
     79 </li>
     80 <li>
     81 <p>The order of specifying the <b>-L</b>, <b>-l</b>, and <b>-R</b> options, and the order of specifying <b>-l</b> options with
     82 respect to <i>pathname</i> operands is significant.</p>
     83 </li>
     84 <li>
     85 <p>Conforming applications shall specify each option separately; that is, grouping option letters (for example, <b>-cO</b>) need
     86 not be recognized by all implementations.</p>
     87 </li>
     88 </ul>
     89 <p>The following options shall be supported:</p>
     90 <dl compact>
     91 <dd></dd>
     92 <dt><b>-B&nbsp;</b><i>mode</i></dt>
     93 <dd>If <i>mode</i> is <b>dynamic</b>, produce a dynamically linked executable file. If the <b>-B</b> option is present with
     94 <b>-c</b>, <b>-E</b>, or <b>-G</b>, the result is unspecified.</dd>
     95 <dt><b>-c</b></dt>
     96 <dd>Suppress the link-edit phase of the compilation, and do not remove any object files that are produced. The application shall
     97 ensure that all operands are of the form <i>file</i><b>.c</b> or <i>file</i><b>.i</b>.</dd>
     98 <dt><b>-D&nbsp;</b><i>name</i><b>[=</b><i>value</i><b>]</b></dt>
     99 <dd><br>
    100 Define <i>name</i> as if by a C-language <b>#define</b> directive. If no =<i>value</i> is given, a value of 1 shall be used. The
    101 <b>-D</b> option has lower precedence than the <b>-U</b> option. That is, if <i>name</i> is used in both a <b>-U</b> and a
    102 <b>-D</b> option, <i>name</i> shall be undefined regardless of the order of the options. Additional implementation-defined
    103 <i>name</i>s may be provided by the compiler. Implementations shall support at least 2048 bytes of <b>-D</b> definitions and 256
    104 <i>names</i>.</dd>
    105 <dt><b>-E</b></dt>
    106 <dd>Copy C-language source files to standard output, executing all preprocessor directives; no compilation shall be performed. If
    107 any operand is not a text file, the effects are unspecified.</dd>
    108 <dt><b>-G</b></dt>
    109 <dd>Create a shared library or create object files suitable for inclusion in such a shared library. Compilations shall be performed
    110 in a manner suitable for the creation of shared libraries (for example, by producing position-independent code).
    111 <p>If <b>-c</b> is also specified, create object files suitable for inclusion in a shared library.</p>
    112 <p>If <b>-c</b> is not specified, create a shared library. In this case the application shall ensure that the file named by the
    113 <b>-o</b> <i>outfile</i> option-argument includes an element named <b>so</b> or an implementation-defined element denoting a shared
    114 library, where elements in the last component of <i>outfile</i> are separated by &lt;period&gt; characters, for example
    115 <b>libx.so.1</b>; if no <b>-o</b> option is included in the options or the file named by the <b>-o</b> <i>outfile</i> option does
    116 not contain an element named <b>so</b> or an implementation-defined element denoting a shared library, the result is unspecified.
    117 If a <i>pathname</i> operand or <b>-l</b> option-argument names a shared library and that shared library defines an object used by
    118 the library being created, it shall become a dependency of the created shared library.</p>
    119 <p>If the <b>-G</b> option is present with <b>-B</b> or <b>-E</b>, the result is unspecified.</p>
    120 </dd>
    121 <dt><b>-g</b></dt>
    122 <dd>Produce symbolic information in the object or executable files; the nature of this information is unspecified, and may be
    123 modified by implementation-defined interactions with other options.</dd>
    124 <dt><b>-I&nbsp;</b><i>directory</i></dt>
    125 <dd>Change the algorithm for searching for headers whose names are not absolute pathnames to look in the directory named by the
    126 <i>directory</i> pathname before looking in the usual places. Thus, headers whose names are enclosed in double-quotes (<tt>""</tt>)
    127 shall be searched for first in the directory of the file with the <b>#include</b> line, then in directories named in <b>-I</b>
    128 options, and last in the usual places. For headers whose names are enclosed in angle brackets (<tt>"&lt;&gt;"</tt>), the header
    129 shall be searched for only in directories named in <b>-I</b> options and then in the usual places. Directories named in <b>-I</b>
    130 options shall be searched in the order specified. If the <b>-I</b> option is used to specify a directory that is one of the usual
    131 places searched by default, the results are unspecified. Implementations shall support at least ten instances of this option in a
    132 single <i>c17</i> command invocation.</dd>
    133 <dt><b>-L&nbsp;</b><i>directory</i></dt>
    134 <dd>Change the algorithm of searching for the libraries named in the <b>-l</b> objects to look in the directory named by the
    135 <i>directory</i> pathname before looking in the usual places. Directories named in <b>-L</b> options shall be searched in the order
    136 specified. If the <b>-L</b> option is used to specify a directory that is one of the usual places searched by default, the results
    137 are unspecified. Implementations shall support at least ten instances of this option in a single <i>c17</i> command invocation. If
    138 a directory specified by a <b>-L</b> option contains files with names starting with any of the strings <tt>"libc."</tt>,
    139 <tt>"libl."</tt>, <tt>"libpthread."</tt>, <tt>"libm."</tt>, <tt>"librt."</tt>, <tt>"libxnet."</tt>, or <tt>"liby."</tt>, the
    140 results are unspecified.</dd>
    141 <dt><b>-l&nbsp;</b><i>library</i></dt>
    142 <dd>Search the library named <b>lib<i>library</i>.a</b> or <b>lib<i>library</i>.so</b>. When searching for a library, the linker
    143 shall look at each directory specified by <b>-L</b> options that appear on the command line before this <b>-l</b> option, in the
    144 order given, and then the system default libraries. If <b>lib<i>library</i>.a</b> and <b>lib<i>library</i>.so</b> both exist in a
    145 directory, <i>c17</i> shall use <b>lib<i>library</i>.so</b> if either <b>-B dynamic</b> or <b>-G</b> is specified. Once a library
    146 has been found (shared or static) in a directory, later directories in the list shall not be considered. A library shall be
    147 searched when its name is encountered, so the placement of a <b>-l</b> option is significant. Several standard libraries can be
    148 specified in this manner, as described in the EXTENDED DESCRIPTION section. Implementations may recognize implementation-defined
    149 suffixes other than <b>.a</b> and <b>.so</b> as denoting libraries.</dd>
    150 <dt><b>-O&nbsp;</b><i>optlevel</i></dt>
    151 <dd>Specify the level of code optimization. If the <i>optlevel</i> option-argument is the digit <tt>'0'</tt>, all special code
    152 optimizations shall be disabled. If it is the digit <tt>'1'</tt>, the nature of the optimization is unspecified. If the <b>-O</b>
    153 option is omitted, the nature of the system's default optimization is unspecified. It is unspecified whether code generated in the
    154 presence of the <b>-O</b> 0 option is the same as that generated when <b>-O</b> is omitted. Other <i>optlevel</i> values may be
    155 supported.</dd>
    156 <dt><b>-o&nbsp;</b><i>outfile</i></dt>
    157 <dd>Name the output file to be produced. If the <b>-o</b> option is present with <b>-E</b>, or with <b>-c</b> and more than one
    158 input file, the result is unspecified.
    159 <p>When creating a single object file (by using <b>-c</b> with a single input file), use the pathname <i>outfile</i>, instead of
    160 the default <i>file</i><b>.o</b>, for the object file produced.</p>
    161 <p>When creating an executable file, use the pathname <i>outfile</i>, instead of the default <b>a.out</b>, for the executable file
    162 produced.</p>
    163 <p>When creating a shared library, use the pathname <i>outfile</i> as the name of the shared library. If no <b>-o</b>
    164 <i>outfile</i> option is specified when creating a shared library, the result is unspecified.</p>
    165 </dd>
    166 <dt><b>-s</b></dt>
    167 <dd>Produce object or executable files, or both, from which symbolic and other information not required for proper execution using
    168 the <i>exec</i> family defined in the System Interfaces volume of POSIX.1-2024 has been removed (stripped). If both <b>-g</b> and
    169 <b>-s</b> options are present, the action taken is unspecified.</dd>
    170 <dt><b>-R&nbsp;</b><i>directory</i></dt>
    171 <dd>If the object file format supports it, specify a directory to be searched for shared libraries when an executable file or
    172 shared library being created by <i>c17</i> is subsequently executed, or loaded using <a href=
    173 "../functions/dlopen.html"><i>dlopen</i>()</a>. If <i>directory</i> contains any &lt;colon&gt; or &lt;dollar-sign&gt; characters,
    174 the behavior is unspecified. If an implementation provides a means for setting a default load time search location or locations,
    175 the <b>-R</b> option shall take precedence.
    176 <p>The directory named by <i>directory</i> shall not be searched by a process performing dynamic loading if either of the following
    177 are true:</p>
    178 <ul>
    179 <li>
    180 <p>The real and effective user IDs of that process are different and the directory has write permission for a user ID outside the
    181 set of the effective user ID of that process and any implementation-specific user IDs used for directories containing system
    182 libraries.</p>
    183 </li>
    184 <li>
    185 <p>The real and effective group IDs of that process are different and the directory has write permission for group IDs other than
    186 the effective group ID of that process.</p>
    187 </li>
    188 </ul>
    189 <p>Directories named in <b>-R</b> options shall be searched in the order specified, before the default system library locations are
    190 searched.</p>
    191 <p>If a directory specified by a <b>-R</b> option contains files with names starting with any of the strings <tt>"libc."</tt>,
    192 <tt>"libl."</tt>, <tt>"libpthread."</tt>, <tt>"libm."</tt>, <tt>"librt."</tt>, <tt>"libxnet."</tt>, or <tt>"liby."</tt>, the result
    193 is unspecified.</p>
    194 <p>If the <b>-R</b> option is present with <b>-c</b> or <b>-E</b>, the result is unspecified.</p>
    195 </dd>
    196 <dt><b>-U&nbsp;</b><i>name</i></dt>
    197 <dd>Remove any initial definition of <i>name</i>.</dd>
    198 </dl>
    199 <p>Multiple instances of the <b>-D</b>, <b>-I</b>, <b>-L</b>, <b>-l</b>, <b>-R</b>, and <b>-U</b> options can be specified.</p>
    200 </blockquote>
    201 <h4 class="mansect"><a name="tag_20_11_05" id="tag_20_11_05"></a>OPERANDS</h4>
    202 <blockquote>
    203 <p>The application shall ensure that at least one <i>pathname</i> operand is specified. The following forms for <i>pathname</i>
    204 operands shall be supported:</p>
    205 <dl compact>
    206 <dd></dd>
    207 <dt><i>file.</i><b>c</b></dt>
    208 <dd>A C-language source file to be compiled and optionally linked.</dd>
    209 <dt><i>file.</i><b>i</b></dt>
    210 <dd>A text file containing the output of <i>c17</i> <b>-E</b>, to be compiled and optionally linked. The processing already
    211 performed by <i>c17</i> <b>-E</b> when the file was produced shall not be repeated when the file is compiled.</dd>
    212 <dt><i>file.</i><b>a</b></dt>
    213 <dd>A library of static object files typically produced by the <a href="../utilities/ar.html"><i>ar</i></a> utility, and referenced
    214 during the link-edit phase. Implementations may recognize implementation-defined suffixes other than <b>.a</b> as denoting static
    215 object file libraries.</dd>
    216 <dt><i>file.</i><b>so</b></dt>
    217 <dd>A library of shared object files typically produced by the <i>c17</i> utility with the <b>-G</b> option, and referenced during
    218 the link-edit phase. Implementations may recognize implementation-defined suffixes other than <b>.so</b> as denoting shared object
    219 file libraries.</dd>
    220 <dt><i>file.</i><b>o</b></dt>
    221 <dd>An object file produced by <i>c17</i> <b>-c</b> and passed directly to the link editor. Implementations may recognize
    222 implementation-defined suffixes other than <b>.o</b> as denoting object files.</dd>
    223 </dl>
    224 <p>The processing of other files is implementation-defined.</p>
    225 </blockquote>
    226 <h4 class="mansect"><a name="tag_20_11_06" id="tag_20_11_06"></a>STDIN</h4>
    227 <blockquote>
    228 <p>Not used.</p>
    229 </blockquote>
    230 <h4 class="mansect"><a name="tag_20_11_07" id="tag_20_11_07"></a>INPUT FILES</h4>
    231 <blockquote>
    232 <p>Each input file shall be one of the following:</p>
    233 <ul>
    234 <li>
    235 <p>A text file containing a C-language source program or the output of <i>c17</i> <b>-E</b></p>
    236 </li>
    237 <li>
    238 <p>An object file in the format produced by <i>c17</i> <b>-c</b></p>
    239 </li>
    240 <li>
    241 <p>A library of object files in the format produced by archiving zero or more object files using <a href=
    242 "../utilities/ar.html"><i>ar</i></a></p>
    243 </li>
    244 <li>
    245 <p>A shared library in the format produced by <i>c17</i> <b>-G</b></p>
    246 </li>
    247 </ul>
    248 <p>Implementations may supply additional utilities that produce files in these formats. Additional input file formats are
    249 implementation-defined.</p>
    250 </blockquote>
    251 <h4 class="mansect"><a name="tag_20_11_08" id="tag_20_11_08"></a>ENVIRONMENT VARIABLES</h4>
    252 <blockquote>
    253 <p>The following environment variables shall affect the execution of <i>c17</i>:</p>
    254 <dl compact>
    255 <dd></dd>
    256 <dt><i>LANG</i></dt>
    257 <dd>Provide a default value for the internationalization variables that are unset or null. (See XBD <a href=
    258 "../basedefs/V1_chap08.html#tag_08_02"><i>8.2 Internationalization Variables</i></a> for the precedence of internationalization
    259 variables used to determine the values of locale categories.)</dd>
    260 <dt><i>LC_ALL</i></dt>
    261 <dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
    262 <dt><i>LC_CTYPE</i></dt>
    263 <dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
    264 opposed to multi-byte characters in arguments and input files).</dd>
    265 <dt><i>LC_MESSAGES</i></dt>
    266 <dd><br>
    267 Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.</dd>
    268 <dt><i>NLSPATH</i></dt>
    269 <dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
    270 Determine the location of messages objects and message catalogs. <img src="../images/opt-end.gif" alt="[Option End]" border=
    271 "0"></dd>
    272 <dt><i>TMPDIR</i></dt>
    273 <dd>Provide a pathname that should override the default directory for temporary files, if any. <sup>[<a href=
    274 "javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;On
    275 XSI-conforming systems, provide a pathname that shall override the default directory for temporary files, if any. <img src=
    276 "../images/opt-end.gif" alt="[Option End]" border="0"></dd>
    277 </dl>
    278 </blockquote>
    279 <h4 class="mansect"><a name="tag_20_11_09" id="tag_20_11_09"></a>ASYNCHRONOUS EVENTS</h4>
    280 <blockquote>
    281 <p>Default.</p>
    282 </blockquote>
    283 <h4 class="mansect"><a name="tag_20_11_10" id="tag_20_11_10"></a>STDOUT</h4>
    284 <blockquote>
    285 <p>If more than one <i>pathname</i> operand ending in <b>.c</b> or <b>.i</b> (or possibly other unspecified suffixes) is given, for
    286 each such file:</p>
    287 <pre>
    288 <tt>"%s:\n", &lt;</tt><i>pathname</i><tt>&gt;
    289 </tt></pre>
    290 <p>may be written. These messages, if written, shall precede the processing of each input file; they shall not be written to the
    291 standard output if they are written to the standard error, as described in the STDERR section.</p>
    292 <p>If the <b>-E</b> option is specified, the standard output shall be a text file that represents the results of the preprocessing
    293 stage of the language; it may contain extra information appropriate for subsequent compilation passes and shall contain at least
    294 one line with the format:</p>
    295 <pre>
    296 <tt>"# %d \"%s\"\n", &lt;</tt><i>line</i><tt>&gt;, &lt;</tt><i>pathname</i><tt>&gt;
    297 </tt></pre>
    298 <p>for each file processed as a result of a <b>#include</b> directive, unless no other output generated from that file is present
    299 in the output, where <i>line</i> is a line number and <i>pathname</i> is the pathname used to open the file.</p>
    300 </blockquote>
    301 <h4 class="mansect"><a name="tag_20_11_11" id="tag_20_11_11"></a>STDERR</h4>
    302 <blockquote>
    303 <p>The standard error shall be used only for diagnostic messages, except that if more than one <i>pathname</i> operand ending in
    304 <b>.c</b> or <b>.i</b> (or possibly other unspecified suffixes) is given, for each such file:</p>
    305 <pre>
    306 <tt>"%s:\n", &lt;</tt><i>pathname</i><tt>&gt;
    307 </tt></pre>
    308 <p>may be written to allow identification of the diagnostic and warning messages with the appropriate input file. These messages,
    309 if written, shall precede the processing of each input file; they shall not be written to the standard error if they are written to
    310 the standard output, as described in the STDOUT section.</p>
    311 <p>This utility may produce warning messages about certain conditions that do not warrant returning an error (non-zero) exit
    312 value.</p>
    313 </blockquote>
    314 <h4 class="mansect"><a name="tag_20_11_12" id="tag_20_11_12"></a>OUTPUT FILES</h4>
    315 <blockquote>
    316 <p>Object files or executable files or both are produced in unspecified formats. If the pathname of an object file or executable
    317 file to be created by <i>c17</i> resolves to an existing directory entry for a file that is not a regular file, it is unspecified
    318 whether <i>c17</i> shall attempt to create the file or shall issue a diagnostic and exit with a non-zero exit status.</p>
    319 </blockquote>
    320 <h4 class="mansect"><a name="tag_20_11_13" id="tag_20_11_13"></a>EXTENDED DESCRIPTION</h4>
    321 <blockquote>
    322 <h5><a name="tag_20_11_13_01" id="tag_20_11_13_01"></a>Standard Libraries</h5>
    323 <p>The <i>c17</i> utility shall recognize the following <b>-l</b> options for standard libraries:</p>
    324 <dl compact>
    325 <dd></dd>
    326 <dt><b>-l&nbsp;c</b></dt>
    327 <dd>This option shall make available all interfaces referenced in the System Interfaces volume of POSIX.1-2024, with the possible
    328 exception of those interfaces listed as residing in <a href="../basedefs/aio.h.html"><i>&lt;aio.h&gt;</i></a>, <a href=
    329 "../basedefs/arpa_inet.h.html"><i>&lt;arpa/inet.h&gt;</i></a>, <a href="../basedefs/complex.h.html"><i>&lt;complex.h&gt;</i></a>,
    330 <a href="../basedefs/fenv.h.html"><i>&lt;fenv.h&gt;</i></a>, <a href="../basedefs/math.h.html"><i>&lt;math.h&gt;</i></a>, <a href=
    331 "../basedefs/mqueue.h.html"><i>&lt;mqueue.h&gt;</i></a>, <a href="../basedefs/netdb.h.html"><i>&lt;netdb.h&gt;</i></a>, <a href=
    332 "../basedefs/net_if.h.html"><i>&lt;net/if.h&gt;</i></a>, <a href="../basedefs/netinet_in.h.html"><i>&lt;netinet/in.h&gt;</i></a>,
    333 <a href="../basedefs/pthread.h.html"><i>&lt;pthread.h&gt;</i></a>, <a href="../basedefs/sched.h.html"><i>&lt;sched.h&gt;</i></a>,
    334 <a href="../basedefs/semaphore.h.html"><i>&lt;semaphore.h&gt;</i></a>, <a href=
    335 "../basedefs/spawn.h.html"><i>&lt;spawn.h&gt;</i></a>, <a href="../basedefs/sys_socket.h.html"><i>&lt;sys/socket.h&gt;</i></a>,
    336 <a href="../basedefs/threads.h.html"><i>&lt;threads.h&gt;</i></a>, <a href=
    337 "../functions/pthread_kill.html"><i>pthread_kill</i>()</a> and <a href=
    338 "../functions/pthread_sigmask.html"><i>pthread_sigmask</i>()</a> in <a href=
    339 "../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a>, interfaces marked as optional in <a href=
    340 "../basedefs/sys_mman.h.html"><i>&lt;sys/mman.h&gt;</i></a>, interfaces marked as ADV (Advisory Information) in <a href=
    341 "../basedefs/fcntl.h.html"><i>&lt;fcntl.h&gt;</i></a>, and interfaces beginning with the prefix clock_ or timer_ in <a href=
    342 "../basedefs/time.h.html"><i>&lt;time.h&gt;</i></a>. This option shall not be required to be present to cause a search of this
    343 library.</dd>
    344 <dt><b>-l&nbsp;l</b></dt>
    345 <dd>This option shall make available all interfaces required by the C-language output of <a href=
    346 "../utilities/lex.html"><i>lex</i></a> that are not made available through the <b>-l&nbsp;c</b> option.</dd>
    347 <dt><b>-l&nbsp;pthread</b></dt>
    348 <dd>This option shall make available all interfaces referenced in <a href="../basedefs/pthread.h.html"><i>&lt;pthread.h&gt;</i></a>
    349 and <a href="../basedefs/threads.h.html"><i>&lt;threads.h&gt;</i></a>, and also <a href=
    350 "../functions/pthread_kill.html"><i>pthread_kill</i>()</a> and <a href=
    351 "../functions/pthread_sigmask.html"><i>pthread_sigmask</i>()</a> referenced in <a href=
    352 "../basedefs/signal.h.html"><i>&lt;signal.h&gt;</i></a>. An implementation may search this library in the absence of this
    353 option.</dd>
    354 <dt><b>-l&nbsp;m</b></dt>
    355 <dd>This option shall make available all interfaces referenced in <a href="../basedefs/math.h.html"><i>&lt;math.h&gt;</i></a>,
    356 <a href="../basedefs/complex.h.html"><i>&lt;complex.h&gt;</i></a>, and <a href="../basedefs/fenv.h.html"><i>&lt;fenv.h&gt;</i></a>.
    357 An implementation may search this library in the absence of this option.</dd>
    358 <dt><b>-l&nbsp;rt</b></dt>
    359 <dd>This option shall make available all interfaces referenced in <a href="../basedefs/aio.h.html"><i>&lt;aio.h&gt;</i></a>,
    360 <a href="../basedefs/mqueue.h.html"><i>&lt;mqueue.h&gt;</i></a>, <a href="../basedefs/sched.h.html"><i>&lt;sched.h&gt;</i></a>,
    361 <a href="../basedefs/semaphore.h.html"><i>&lt;semaphore.h&gt;</i></a>, and <a href=
    362 "../basedefs/spawn.h.html"><i>&lt;spawn.h&gt;</i></a>, interfaces marked as optional in <a href=
    363 "../basedefs/sys_mman.h.html"><i>&lt;sys/mman.h&gt;</i></a>, interfaces marked as ADV (Advisory Information) in <a href=
    364 "../basedefs/fcntl.h.html"><i>&lt;fcntl.h&gt;</i></a>, and interfaces beginning with the prefix clock_ and timer_ in <a href=
    365 "../basedefs/time.h.html"><i>&lt;time.h&gt;</i></a>. An implementation may search this library in the absence of this option.</dd>
    366 <dt><b>-l&nbsp;xnet</b></dt>
    367 <dd>This option shall make available all interfaces referenced in <a href=
    368 "../basedefs/arpa_inet.h.html"><i>&lt;arpa/inet.h&gt;</i></a>, <a href="../basedefs/netdb.h.html"><i>&lt;netdb.h&gt;</i></a>,
    369 <a href="../basedefs/net_if.h.html"><i>&lt;net/if.h&gt;</i></a>, <a href=
    370 "../basedefs/netinet_in.h.html"><i>&lt;netinet/in.h&gt;</i></a>, and <a href=
    371 "../basedefs/sys_socket.h.html"><i>&lt;sys/socket.h&gt;</i></a>. An implementation may search this library in the absence of this
    372 option.</dd>
    373 <dt><b>-l&nbsp;y</b></dt>
    374 <dd>This option shall make available all interfaces required by the C-language output of <a href=
    375 "../utilities/yacc.html"><i>yacc</i></a> that are not made available through the <b>-l&nbsp;c</b> option.</dd>
    376 </dl>
    377 <p>In the absence of options that inhibit invocation of the link editor, such as <b>-c</b> or <b>-E</b>, the <i>c17</i> utility
    378 shall cause the equivalent of a <b>-l&nbsp;c</b> option to be passed to the link editor after the last <i>pathname</i> operand or
    379 <b>-l</b> option, causing it to be searched after all other object files and libraries are loaded.</p>
    380 <p>The libraries <b>c</b>, <b>l</b>, <b>m</b>, <b>pthread</b>, <b>rt</b>, <b>xnet</b>, and <b>y</b> shall be found as shared
    381 libraries when specified as the option-argument to the <b>-l</b> option and may also be found as static libraries but, except for
    382 the shared library version of the <b>c</b> library, need not exist as regular files. The implementation may accept as <b>-l</b>
    383 option-arguments names of additional implementation-defined libraries that do not exist as regular files.</p>
    384 <h5><a name="tag_20_11_13_02" id="tag_20_11_13_02"></a>External Symbols</h5>
    385 <p>The C compiler and link editor shall support the significance of external symbols up to a length of at least 31 bytes; the
    386 action taken upon encountering symbols exceeding the implementation-defined maximum symbol length is unspecified.</p>
    387 <p>The compiler and link editor shall support a minimum of 4095 external identifiers in one translation unit. A diagnostic message
    388 shall be written to the standard output if the implementation-defined limit is exceeded; other actions are unspecified.</p>
    389 <h5><a name="tag_20_11_13_03" id="tag_20_11_13_03"></a>Header Search</h5>
    390 <p>If a file with the same name as one of the standard headers defined in XBD <a href="../basedefs/V1_chap14.html#tag_14"><i>14.
    391 Headers</i></a> , not provided as part of the implementation, is placed in any of the usual places that are searched by default for
    392 headers, the results are unspecified.</p>
    393 <h5><a name="tag_20_11_13_04" id="tag_20_11_13_04"></a>Programming Environments</h5>
    394 <p>All implementations shall support one of the following programming environments as a default. Implementations may support more
    395 than one of the following programming environments. Applications can use the _POSIX_V<i>n</i>_ILP* and _POSIX_V<i>n</i>_LP*
    396 constants in <a href="../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a>, and corresponding <a href=
    397 "../functions/sysconf.html"><i>sysconf</i>()</a> and <a href="../utilities/getconf.html"><i>getconf</i></a> calls, to determine
    398 which programming environments are supported.<br></p>
    399 <p class="caption"><a name="tagtcjh_16" id="tagtcjh_16"></a> Table: Programming Environments: Type Sizes</p>
    400 <center>
    401 <table border="1" cellpadding="3" align="center">
    402 <tr valign="top">
    403 <th align="center">
    404 <p class="tent"><b>Programming Environment <i>getconf</i> Name</b></p>
    405 </th>
    406 <th align="center">
    407 <p class="tent"><b>Bits in int</b></p>
    408 </th>
    409 <th align="center">
    410 <p class="tent"><b>Bits in long</b></p>
    411 </th>
    412 <th align="center">
    413 <p class="tent"><b>Bits in all pointer types</b></p>
    414 </th>
    415 <th align="center">
    416 <p class="tent"><b>Bits in off_t</b></p>
    417 </th>
    418 </tr>
    419 <tr valign="top">
    420 <td align="left">
    421 <p class="tent">_POSIX_V8_ILP32_OFF32</p>
    422 </td>
    423 <td align="left">
    424 <p class="tent">32</p>
    425 </td>
    426 <td align="left">
    427 <p class="tent">32</p>
    428 </td>
    429 <td align="left">
    430 <p class="tent">32</p>
    431 </td>
    432 <td align="left">
    433 <p class="tent">32</p>
    434 </td>
    435 </tr>
    436 <tr valign="top">
    437 <td align="left">
    438 <p class="tent">_POSIX_V8_ILP32_OFFBIG</p>
    439 </td>
    440 <td align="left">
    441 <p class="tent">32</p>
    442 </td>
    443 <td align="left">
    444 <p class="tent">32</p>
    445 </td>
    446 <td align="left">
    447 <p class="tent">32</p>
    448 </td>
    449 <td align="left">
    450 <p class="tent">&gt;=64</p>
    451 </td>
    452 </tr>
    453 <tr valign="top">
    454 <td align="left">
    455 <p class="tent">_POSIX_V8_LP64_OFF64</p>
    456 </td>
    457 <td align="left">
    458 <p class="tent">32</p>
    459 </td>
    460 <td align="left">
    461 <p class="tent">64</p>
    462 </td>
    463 <td align="left">
    464 <p class="tent">64</p>
    465 </td>
    466 <td align="left">
    467 <p class="tent">64</p>
    468 </td>
    469 </tr>
    470 <tr valign="top">
    471 <td align="left">
    472 <p class="tent">_POSIX_V8_LPBIG_OFFBIG</p>
    473 </td>
    474 <td align="left">
    475 <p class="tent">&gt;=32</p>
    476 </td>
    477 <td align="left">
    478 <p class="tent">&gt;=64</p>
    479 </td>
    480 <td align="left">
    481 <p class="tent">&gt;=64</p>
    482 </td>
    483 <td align="left">
    484 <p class="tent">&gt;=64</p>
    485 </td>
    486 </tr>
    487 </table>
    488 </center>
    489 <p class="tent">All implementations shall support one or more environments where the widths of the following types are no greater
    490 than the width of type <b>long</b>:</p>
    491 <center>
    492 <table cellpadding="3" align="center">
    493 <tr valign="top">
    494 <td align="left">
    495 <p class="tent"><b><br>
    496 blksize_t<br>
    497 cc_t<br>
    498 mode_t<br>
    499 nfds_t<br>
    500 pid_t<br></b></p>
    501 </td>
    502 <td align="left">
    503 <p class="tent"><b><br>
    504 ptrdiff_t<br>
    505 size_t<br>
    506 speed_t<br>
    507 ssize_t<br>
    508 suseconds_t<br></b></p>
    509 </td>
    510 <td align="left">
    511 <p class="tent"><b><br>
    512 tcflag_t<br>
    513 wchar_t<br>
    514 wint_t<br></b></p>
    515 </td>
    516 </tr>
    517 </table>
    518 </center>
    519 <p class="tent">The executable files created when these environments are selected shall be in a proper format for execution by the
    520 <i>exec</i> family of functions. Each environment may be one of the ones in <a href="#tagtcjh_16">Programming Environments: Type
    521 Sizes</a> , or it may be another environment. The names for the environments that meet this requirement shall be output by a
    522 <a href="../utilities/getconf.html"><i>getconf</i></a> command using the POSIX_V8_WIDTH_RESTRICTED_ENVS argument, as a
    523 &lt;newline&gt;-separated list of names suitable for use with the <a href="../utilities/getconf.html"><i>getconf</i></a> <b>-v</b>
    524 option. If more than one environment meets the requirement, the names of all such environments shall be output on separate lines.
    525 Any of these names can then be used in a subsequent <a href="../utilities/getconf.html"><i>getconf</i></a> command to obtain the
    526 flags specific to that environment with the following suffixes added as appropriate:</p>
    527 <dl compact>
    528 <dd></dd>
    529 <dt>_CFLAGS</dt>
    530 <dd>To get the C compiler flags.</dd>
    531 <dt>_LDFLAGS</dt>
    532 <dd>To get the linker/loader flags.</dd>
    533 <dt>_LIBS</dt>
    534 <dd>To get the libraries.</dd>
    535 </dl>
    536 <p class="tent">This requirement may be removed in a future version.</p>
    537 <p class="tent">When this utility processes a file containing a function called <i>main</i>(), it shall be defined with a return
    538 type equivalent to <b>int</b>. Using return from the initial call to <i>main</i>() shall be equivalent (other than with respect to
    539 language scope issues) to calling <a href="../functions/exit.html"><i>exit</i>()</a> with the returned value. Reaching the end of
    540 the initial call to <i>main</i>() shall be equivalent to calling <i>exit</i>(0). The implementation shall not declare a prototype
    541 for this function.</p>
    542 <p class="tent">Implementations provide configuration strings for C compiler flags, linker/loader flags, and libraries for each
    543 supported environment. When an application needs to use a specific programming environment rather than the implementation default
    544 programming environment while compiling, the application shall first verify that the implementation supports the desired
    545 environment. If the desired programming environment is supported, the application shall then invoke <i>c17</i> with the appropriate
    546 C compiler flags as the first options for the compile, the appropriate linker/loader flags after any other options except <b>-l</b>
    547 but before any operands or <b>-l</b> options, and the appropriate libraries at the end of the operands and <b>-l</b> options.</p>
    548 <p class="tent">Conforming applications shall not attempt to link together object files compiled for different programming models.
    549 Applications shall also be aware that binary data placed in shared memory or in files might not be recognized by applications built
    550 for other programming models.<br></p>
    551 <p class="caption">Table: Programming Environments: <i>c17</i> Arguments</p>
    552 <center>
    553 <table border="1" cellpadding="3" align="center">
    554 <tr valign="top">
    555 <th align="center">
    556 <p class="tent"><b>Programming Environment <i>getconf</i> Name</b></p>
    557 </th>
    558 <th align="center">
    559 <p class="tent"><b>Use</b></p>
    560 </th>
    561 <th align="center">
    562 <p class="tent"><b><i>c17</i> Arguments <i>getconf</i> Name</b></p>
    563 </th>
    564 </tr>
    565 <tr valign="top">
    566 <td align="left">
    567 <p class="tent">_POSIX_V8_ILP32_OFF32</p>
    568 </td>
    569 <td align="left">
    570 <p class="tent">C Compiler Flags</p>
    571 </td>
    572 <td align="left">
    573 <p class="tent">POSIX_V8_ILP32_OFF32_CFLAGS</p>
    574 </td>
    575 </tr>
    576 <tr valign="top">
    577 <td align="left">
    578 <p class="tent">&nbsp;</p>
    579 </td>
    580 <td align="left">
    581 <p class="tent">Linker/Loader Flags</p>
    582 </td>
    583 <td align="left">
    584 <p class="tent">POSIX_V8_ILP32_OFF32_LDFLAGS</p>
    585 </td>
    586 </tr>
    587 <tr valign="top">
    588 <td align="left">
    589 <p class="tent">&nbsp;</p>
    590 </td>
    591 <td align="left">
    592 <p class="tent">Libraries</p>
    593 </td>
    594 <td align="left">
    595 <p class="tent">POSIX_V8_ILP32_OFF32_LIBS</p>
    596 </td>
    597 </tr>
    598 <tr valign="top">
    599 <td align="left">
    600 <p class="tent">_POSIX_V8_ILP32_OFFBIG</p>
    601 </td>
    602 <td align="left">
    603 <p class="tent">C Compiler Flags</p>
    604 </td>
    605 <td align="left">
    606 <p class="tent">POSIX_V8_ILP32_OFFBIG_CFLAGS</p>
    607 </td>
    608 </tr>
    609 <tr valign="top">
    610 <td align="left">
    611 <p class="tent">&nbsp;</p>
    612 </td>
    613 <td align="left">
    614 <p class="tent">Linker/Loader Flags</p>
    615 </td>
    616 <td align="left">
    617 <p class="tent">POSIX_V8_ILP32_OFFBIG_LDFLAGS</p>
    618 </td>
    619 </tr>
    620 <tr valign="top">
    621 <td align="left">
    622 <p class="tent">&nbsp;</p>
    623 </td>
    624 <td align="left">
    625 <p class="tent">Libraries</p>
    626 </td>
    627 <td align="left">
    628 <p class="tent">POSIX_V8_ILP32_OFFBIG_LIBS</p>
    629 </td>
    630 </tr>
    631 <tr valign="top">
    632 <td align="left">
    633 <p class="tent">_POSIX_V8_LP64_OFF64</p>
    634 </td>
    635 <td align="left">
    636 <p class="tent">C Compiler Flags</p>
    637 </td>
    638 <td align="left">
    639 <p class="tent">POSIX_V8_LP64_OFF64_CFLAGS</p>
    640 </td>
    641 </tr>
    642 <tr valign="top">
    643 <td align="left">
    644 <p class="tent">&nbsp;</p>
    645 </td>
    646 <td align="left">
    647 <p class="tent">Linker/Loader Flags</p>
    648 </td>
    649 <td align="left">
    650 <p class="tent">POSIX_V8_LP64_OFF64_LDFLAGS</p>
    651 </td>
    652 </tr>
    653 <tr valign="top">
    654 <td align="left">
    655 <p class="tent">&nbsp;</p>
    656 </td>
    657 <td align="left">
    658 <p class="tent">Libraries</p>
    659 </td>
    660 <td align="left">
    661 <p class="tent">POSIX_V8_LP64_OFF64_LIBS</p>
    662 </td>
    663 </tr>
    664 <tr valign="top">
    665 <td align="left">
    666 <p class="tent">_POSIX_V8_LPBIG_OFFBIG</p>
    667 </td>
    668 <td align="left">
    669 <p class="tent">C Compiler Flags</p>
    670 </td>
    671 <td align="left">
    672 <p class="tent">POSIX_V8_LPBIG_OFFBIG_CFLAGS</p>
    673 </td>
    674 </tr>
    675 <tr valign="top">
    676 <td align="left">
    677 <p class="tent">&nbsp;</p>
    678 </td>
    679 <td align="left">
    680 <p class="tent">Linker/Loader Flags</p>
    681 </td>
    682 <td align="left">
    683 <p class="tent">POSIX_V8_LPBIG_OFFBIG_LDFLAGS</p>
    684 </td>
    685 </tr>
    686 <tr valign="top">
    687 <td align="left">
    688 <p class="tent">&nbsp;</p>
    689 </td>
    690 <td align="left">
    691 <p class="tent">Libraries</p>
    692 </td>
    693 <td align="left">
    694 <p class="tent">POSIX_V8_LPBIG_OFFBIG_LIBS</p>
    695 </td>
    696 </tr>
    697 </table>
    698 </center>
    699 <p class="tent">In addition to the type size programming environments above, all implementations also support a multi-threaded
    700 programming environment that is orthogonal to all of the programming environments listed above. The <a href=
    701 "../utilities/getconf.html"><i>getconf</i></a> utility can be used to get flags for the threaded programming environment, as
    702 indicated in <a href="#tagtcjh_16">Programming Environments: Type Sizes</a> .</p>
    703 <p class="caption">Table: Threaded Programming Environment: <i>c17</i> Arguments</p>
    704 <center>
    705 <table border="1" cellpadding="3" align="center">
    706 <tr valign="top">
    707 <th align="center">
    708 <p class="tent"><b>Programming Environment <i>getconf</i> Name</b></p>
    709 </th>
    710 <th align="center">
    711 <p class="tent"><b>Use</b></p>
    712 </th>
    713 <th align="center">
    714 <p class="tent"><b><i>c17</i> Arguments <i>getconf</i> Name</b></p>
    715 </th>
    716 </tr>
    717 <tr valign="top">
    718 <td align="left">
    719 <p class="tent">_POSIX_THREADS</p>
    720 </td>
    721 <td align="left">
    722 <p class="tent">C Compiler Flags</p>
    723 </td>
    724 <td align="left">
    725 <p class="tent">POSIX_V8_THREADS_CFLAGS</p>
    726 </td>
    727 </tr>
    728 <tr valign="top">
    729 <td align="left">
    730 <p class="tent">&nbsp;</p>
    731 </td>
    732 <td align="left">
    733 <p class="tent">Linker/Loader Flags</p>
    734 </td>
    735 <td align="left">
    736 <p class="tent">POSIX_V8_THREADS_LDFLAGS</p>
    737 </td>
    738 </tr>
    739 </table>
    740 </center>
    741 <p class="tent">These programming environment flags may be used in conjunction with any of the type size programming environments
    742 supported by the implementation.</p>
    743 </blockquote>
    744 <h4 class="mansect"><a name="tag_20_11_14" id="tag_20_11_14"></a>EXIT STATUS</h4>
    745 <blockquote>
    746 <p>The following exit values shall be returned:</p>
    747 <dl compact>
    748 <dd></dd>
    749 <dt>&nbsp;0</dt>
    750 <dd>Successful compilation or link edit.</dd>
    751 <dt>&gt;0</dt>
    752 <dd>An error occurred.</dd>
    753 </dl>
    754 </blockquote>
    755 <h4 class="mansect"><a name="tag_20_11_15" id="tag_20_11_15"></a>CONSEQUENCES OF ERRORS</h4>
    756 <blockquote>
    757 <p>When <i>c17</i> encounters a compilation error that causes an object file not to be created, it shall write a diagnostic to
    758 standard error and continue to compile other source code operands, but it shall not perform the link phase and it shall return a
    759 non-zero exit status. If the link edit is unsuccessful, a diagnostic message shall be written to standard error and <i>c17</i>
    760 exits with a non-zero status. A conforming application shall rely on the exit status of <i>c17</i>, rather than on the existence or
    761 mode of the executable file.</p>
    762 </blockquote>
    763 <hr>
    764 <div class="box"><em>The following sections are informative.</em></div>
    765 <h4 class="mansect"><a name="tag_20_11_16" id="tag_20_11_16"></a>APPLICATION USAGE</h4>
    766 <blockquote>
    767 <p>Since the <i>c17</i> utility usually creates files in the current directory during the compilation process, it is typically
    768 necessary to run the <i>c17</i> utility in a directory in which a file can be created.</p>
    769 <p class="tent">On systems providing POSIX Conformance (see XBD <a href="../basedefs/V1_chap02.html#tag_02"><i>2.
    770 Conformance</i></a> ), <i>c17</i> is required only with the C-Language Development option; XSI-conformant systems always provide
    771 <i>c17</i>.</p>
    772 <p class="tent">Since this standard requires that conforming applications define either _POSIX_C_SOURCE or _XOPEN_SOURCE before
    773 inclusion of any header (see XSH <a href="../functions/V2_chap02.html#tag_16_02_01"><i>2.2.1 POSIX.1 Symbols</i></a> ), if
    774 <i>c17</i> is used to compile source code that includes a header without defining one of these feature test macros in the required
    775 manner, the behavior of <i>c17</i> itself and the results of using any files it generates are undefined. When <i>c17</i> is used
    776 this way, implementations are encouraged to make visible in headers from the ISO&nbsp;C standard only the symbols that are allowed
    777 by that standard, and otherwise to behave the same as if _POSIX_C_SOURCE or _XOPEN_SOURCE had been defined, but portable
    778 applications cannot rely on this.</p>
    779 <p class="tent">Some historical implementations have created <b>.o</b> files when <b>-c</b> is not specified and more than one
    780 source file is given. Since this area is left unspecified, the application cannot rely on <b>.o</b> files being created, but it
    781 also must be prepared for any related <b>.o</b> files that already exist being deleted at the completion of the link edit.</p>
    782 <p class="tent">There is the possible implication that if a user supplies versions of the standard functions (before they would be
    783 encountered by an implicit <b>-l&nbsp;c</b> or explicit <b>-l&nbsp;m</b>), that those versions would be used in place of the
    784 standard versions. There are various reasons this might not be true (functions defined as macros, manipulations for clean name
    785 space, and so on), so the existence of files named in the same manner as the standard libraries within the <b>-L</b> directories is
    786 explicitly stated to produce unspecified behavior.</p>
    787 <p class="tent">All of the functions specified in the System Interfaces volume of POSIX.1-2024 may be made visible by
    788 implementations when the Standard C Library is searched. Conforming applications must explicitly request searching the other
    789 standard libraries when functions made visible by those libraries are used.</p>
    790 <p class="tent">In the ISO&nbsp;C standard the mapping from physical source characters to the C source character set is
    791 implementation-defined. Implementations may strip white-space characters before the terminating &lt;newline&gt; of a (physical)
    792 line as part of this mapping and, as a consequence of this, one or more white-space characters (and no other characters) between a
    793 &lt;backslash&gt; character and the &lt;newline&gt; character that terminates the line produces implementation-defined results.
    794 Portable applications should not use such constructs.</p>
    795 <p class="tent">Some <i>c17</i> compilers not conforming to POSIX.1-2024 do not support trigraphs by default.</p>
    796 <p class="tent">Implementations may support multiple programming environments with some of them conforming to this standard and
    797 some not conforming. The _POSIX_V<i>n</i>_ILP* and _POSIX_V<i>n</i>_LP* constants in <a href=
    798 "../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a>, and corresponding <a href="../functions/sysconf.html"><i>sysconf</i>()</a>
    799 and <a href="../utilities/getconf.html"><i>getconf</i></a> calls, only indicate whether each programming environment is supported;
    800 they do not indicate anything about conformance of the environments that are supported. For example, an implementation may support
    801 the ILP32_OFF32 environment for legacy reasons with a 32-bit <b>time_t</b>, whereas in a conforming environment <b>time_t</b> is
    802 required to have a width of at least 64 bits. Application writers should consult an implementation's POSIX Conformance Document for
    803 information about the conformance of each supported programming environment.</p>
    804 </blockquote>
    805 <h4 class="mansect"><a name="tag_20_11_17" id="tag_20_11_17"></a>EXAMPLES</h4>
    806 <blockquote>
    807 <ol>
    808 <li class="tent">The following usage example compiles <b>foo.c</b> and creates the executable file <b>foo</b>:
    809 <pre>
    810 <tt>c17 -o foo foo.c
    811 </tt></pre>
    812 <p class="tent">The following usage example compiles <b>foo.c</b> and creates the object file <b>foo.o</b>:</p>
    813 <pre>
    814 <tt>c17 -c foo.c
    815 </tt></pre>
    816 <p class="tent">The following usage example compiles <b>foo.c</b> and creates the executable file <b>a.out</b>:</p>
    817 <pre>
    818 <tt>c17 foo.c
    819 </tt></pre>
    820 <p class="tent">The following usage example compiles <b>foo.c</b>, links it with <b>bar.o</b>, and creates the executable file
    821 <b>a.out</b>. It may also create and leave <b>foo.o</b>:</p>
    822 <pre>
    823 <tt>c17 foo.c bar.o
    824 </tt></pre>
    825 <p class="tent">The following usage example preprocesses <b>foo.c</b> and <b>bar.c</b> to create <b>foo.i</b> and <b>bar.i</b>,
    826 compiles <b>foo.i</b> and <b>bar.i</b> to create <b>foo.o</b> and <b>bar.o</b>, then links <b>foo.o</b> and <b>bar.o</b> to create
    827 the executable file <b>foobar</b>. Each <i>c17</i> execution would ideally be invoked from a separate rule in a makefile (see
    828 <a href="../utilities/make.html#"><i>make</i></a> ) with suitable dependencies so that each is only executed when it needs to
    829 be:</p>
    830 <pre>
    831 <tt>c17 -E foo.c &gt; foo.i
    832 c17 -E bar.c &gt; bar.i
    833 c17 -c foo.i
    834 c17 -c bar.i
    835 c17 -o foobar foo.o bar.o
    836 </tt></pre></li>
    837 <li class="tent">The following example shows how an application using threads interfaces can test for support of and use a
    838 programming environment supporting 32-bit <b>int</b>, <b>long</b>, and all pointer types, and an <b>off_t</b> type using at least
    839 64 bits:
    840 <pre>
    841 <tt>offbig_env=$(getconf _POSIX_V8_ILP32_OFFBIG)
    842 if [ $offbig_env != "-1" ] &amp;& [ $offbig_env != "undefined" ]
    843 then
    844     c17 $(getconf POSIX_V8_ILP32_OFFBIG_CFLAGS) \
    845     $(getconf POSIX_V8_THREADS_CFLAGS) -D_XOPEN_SOURCE=800 \
    846     $(getconf POSIX_V8_ILP32_OFFBIG_LDFLAGS) \
    847     $(getconf POSIX_V8_THREADS_LDFLAGS) foo.c -o foo \
    848     $(getconf POSIX_V8_ILP32_OFFBIG_LIBS) \
    849     -l pthread
    850 else
    851     echo ILP32_OFFBIG programming environment not supported
    852     exit 1
    853 fi
    854 </tt></pre></li>
    855 <li class="tent">The following examples clarify the use and interactions of <b>-L</b> and <b>-l</b> options.
    856 <p class="tent">Consider the case in which module <b>a.c</b> calls function <i>f</i>() in library <b>libQ.a</b>, and module
    857 <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 command line
    858 to compile and link in the desired way is:</p>
    859 <pre>
    860 <tt>c17 -L /a/b/c main.o a.c -l Q b.c -l p
    861 </tt></pre>
    862 <p class="tent">In this case the <b>-L</b> option need only precede the first <b>-l</b> option, since both <b>libQ.a</b> and
    863 <b>libp.a</b> reside in the same directory.</p>
    864 <p class="tent">Multiple <b>-L</b> options can be used when library name collisions occur. Building on the previous example,
    865 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>:</p>
    866 <pre>
    867 <tt>c17 -L /a/a/a -L /a/b/c main.o a.c -l Q b.c -l p
    868 </tt></pre>
    869 <p class="tent">In this example, the linker searches the <b>-L</b> options in the order specified, and finds <b>/a/a/a/libp.a</b>
    870 before <b>/a/b/c/libp.a</b> when resolving references for <b>b.c</b>. The order of the <b>-l</b> options is still important,
    871 however.</p>
    872 </li>
    873 <li class="tent">The following example shows how an application can use a programming environment where the widths of the following
    874 types: <b>blksize_t</b>, <b>cc_t</b>, <b>mode_t</b>, <b>nfds_t</b>, <b>pid_t</b>, <b>ptrdiff_t</b>, <b>size_t</b>, <b>speed_t</b>,
    875 <b>ssize_t</b>, <b>suseconds_t</b>, <b>tcflag_t</b>, <b>wchar_t</b>, <b>wint_t</b>
    876 <p class="tent">are no greater than the width of type <b>long</b>:</p>
    877 <pre>
    878 <tt># First choose one of the listed environments ...
    879 <br class="tent">
    880 # ... if there are no additional constraints, the first one will do:
    881 CENV=$(getconf POSIX_V8_WIDTH_RESTRICTED_ENVS | head -n l)
    882 <br class="tent">
    883 # ... or, if an environment that supports large files is preferred,
    884 # look for names that contain "OFF64" or "OFFBIG". (This chooses
    885 # the last one in the list if none match.)
    886 for CENV in $(getconf POSIX_V8_WIDTH_RESTRICTED_ENVS)
    887 do
    888     case $CENV in
    889     *OFF64*|*OFFBIG*) break ;;
    890     esac
    891 done
    892 <br class="tent">
    893 # The chosen environment name can now be used like this:
    894 <br class="tent">
    895 c17 $(getconf ${CENV}_CFLAGS) -D _POSIX_C_SOURCE=202405L \
    896 $(getconf ${CENV}_LDFLAGS) foo.c -o foo \
    897 $(getconf ${CENV}_LIBS)
    898 </tt></pre></li>
    899 <li class="tent">The following example shows how to create a shared library that does not depend on any other shared library:
    900 <pre>
    901 <tt>c17 -G -c foo.c bar.c
    902 c17 -G -o foobar.so foo.o bar.o
    903 </tt></pre></li>
    904 <li class="tent">The following example shows how to create a dynamic executable that loads application specific shared libraries by
    905 searching a specified list of directories when it is executed:
    906 <pre>
    907 <tt>c17 -G -c foo.c
    908 c17 -G -o /path/to/dir1/foo.so foo.o
    909 c17 -G -c bar.c
    910 c17 -G -o /path/to/dir2/bar.so bar.o
    911 c17 -B dynamic -L /path/to/dir1 -L /path/to/dir2 -R /path/to/dir1 \
    912     -R /path/to/dir2 -o foobar foobar.c -l foo -l bar
    913 </tt></pre></li>
    914 </ol>
    915 </blockquote>
    916 <h4 class="mansect"><a name="tag_20_11_18" id="tag_20_11_18"></a>RATIONALE</h4>
    917 <blockquote>
    918 <p>The <i>c17</i> utility is based on the <i>c89</i> utility originally introduced in the ISO&nbsp;POSIX-2:1993 standard.</p>
    919 <p class="tent">Some of the changes from <i>c89</i> include the ability to intersperse options and operands (which many <i>c89</i>
    920 implementations allowed despite it not being specified), the description of <b>-l</b> as an option instead of an operand, and the
    921 modification to the contents of the Standard Libraries section to account for new headers and options; for example, <a href=
    922 "../basedefs/spawn.h.html"><i>&lt;spawn.h&gt;</i></a> added to the description of <b>-l&nbsp;rt</b>.</p>
    923 <p class="tent">POSIX.1-2024 specifies that the <i>c17</i> utility must be able to use regular files for <b>*.o</b> files and for
    924 <b>a.out</b> files. Implementations are free to overwrite existing files of other types when attempting to create object files and
    925 executable files, but are not required to do so. If something other than a regular file is specified and using it fails for any
    926 reason, <i>c17</i> is required to issue a diagnostic message and exit with a non-zero exit status. But for some file types, the
    927 problem may not be noticed for a long time. For example, if a FIFO named <b>a.out</b> exists in the current directory, <i>c17</i>
    928 may attempt to open <b>a.out</b> and will hang in the <a href="../functions/open.html"><i>open</i>()</a> call until another process
    929 opens the FIFO for reading. Then <i>c17</i> may write most of the <b>a.out</b> to the FIFO and fail when it tries to seek back
    930 close to the start of the file to insert a timestamp (FIFOs are not seekable files). The <i>c17</i> utility is also allowed to
    931 issue a diagnostic immediately if it encounters an <b>a.out</b> or <b>*.o</b> file that is not a regular file. For portable use,
    932 applications should ensure that any <b>a.out</b>, <b>-o</b> option-argument, or <b>*.o</b> files corresponding to any <b>*.c</b>
    933 files do not conflict with names already in use that are not regular files or symbolic links that point to regular files.</p>
    934 <p class="tent">Commands of the form <tt>c17 -c -o ...</tt> are frequently used to directly place the <b>.o</b> file into an
    935 alternative directory without a need to separately rename the output file. This helps to support concurrent compilations and out of
    936 tree builds.</p>
    937 <p class="tent">Some implementations allow <b>-c</b> <b>-o</b> <i>directory</i> to produce
    938 <i>directory</i><b>/</b><i>file</i><b>.o</b> even when there is more than one input file; however, portable applications using
    939 <b>-c</b> with <b>-o</b> must compile only one file at a time and must specify the final destination filename rather than a
    940 directory.</p>
    941 <p class="tent">The shared library version of the <b>c</b> library is required to exist as a regular file because the dynamic
    942 linker needs to be able to load at least one library at execution time. Other standard shared libraries need not exist in their own
    943 right if the interfaces the standard requires them to provide exist in the <b>c</b> library; all that is required is that they are
    944 &quot;found&quot; when specified as <b>-l</b> option-arguments. Static versions of the standard libraries need not exist as regular files,
    945 even if they are found as static libraries when specified as <b>-l</b> option-arguments.</p>
    946 <p class="tent">On many systems, multi-threaded applications run in a programming environment that is distinct from that used by
    947 single-threaded applications. This multi-threaded programming environment (in addition to needing to specify <b>-l pthread</b> at
    948 link time) may require additional flags to be set when headers are processed at compile time (<b>-D_REENTRANT</b> being common).
    949 This programming environment is orthogonal to the type size programming environments discussed above and listed in <a href=
    950 "#tagtcjh_16">Programming Environments: Type Sizes</a> . This version of the standard adds <a href=
    951 "../utilities/getconf.html"><i>getconf</i></a> utility calls to provide the C compiler flags and linker/loader flags needed to
    952 support multi-threaded applications. Note that on a system where single-threaded applications are a special case of a
    953 multi-threaded application, both of these <a href="../utilities/getconf.html"><i>getconf</i></a> calls may return NULL strings; on
    954 other implementations both of these strings may be non-NULL strings.</p>
    955 <p class="tent">The C standardization committee invented trigraphs (e.g., <tt>"??!"</tt> to represent <tt>'|'</tt>) to address
    956 character portability problems in development environments based on national variants of the 7-bit ISO/IEC&nbsp;646:1991 standard
    957 character set. However, these environments were already obsolete by the time the first ISO&nbsp;C standard was published, and in
    958 practice trigraphs have not been used for their intended purpose, and usually are intended to have their original meaning in
    959 K&amp;R C. For example, in practice a C-language source string like <tt>"What??!"</tt> is usually intended to end in two
    960 &lt;question-mark&gt; characters and an &lt;exclamation-mark&gt;, not in <tt>'|'</tt>.</p>
    961 <p class="tent">When the <b>-E</b> option is used, execution of some <b>#pragma</b> preprocessor directives may simply result in a
    962 copy of the directive being included in the output as part of the allowed extra information used by subsequent compilation passes
    963 (see STDOUT).</p>
    964 <p class="tent">This standard requires that, when <b>-E</b> is used, lines beginning with <tt>'#'</tt> are output identifying the
    965 files processed as a result of <b>#include</b> directives in order that <i>c17</i> <b>-E</b> can be used to generate makefile
    966 dependencies. See <a href="../utilities/make.html#"><i>make</i></a> . Usually such lines are output each time the origin of the
    967 subsequent lines in the output changes, and the line number after the <tt>'#'</tt> is the line number in the named file of the line
    968 from which the next line in the output was derived.</p>
    969 <p class="tent">When the <b>-R</b> option is not included when an executable file or shared library is being created, some
    970 implementations use the environment variables <i>LD_RUN_PATH</i> and <i>LD_LIBRARY_PATH</i> to determine the directories to be
    971 searched for shared libraries.</p>
    972 <p class="tent">Some implementations permit place-holders preceded by a &lt;dollar-sign&gt; character (<tt>'$'</tt>), such as
    973 $ORIGIN, in the <b>-R</b> directory option-argument to be evaluated at load time. Some implementations accept a colon separated
    974 list of directories for the path to search for shared libraries, with the same effect as specifying the <b>-R</b> option multiple
    975 times. However, these features are not universal.</p>
    976 <p class="tent">The name of a shared library usually contains an element named <b>so</b>. Other implementation-defined elements are
    977 allowed for backwards compatibility with historical systems, and so that tools can be developed on conforming systems to create
    978 libraries for multiple environments. For example, Microsoft systems use the filename extension <b>.dll</b> (and do not allow
    979 following text) to denote a shared library. The standard allows additional characters to be used in the name of a library following
    980 an <b>so</b> element to permit shared library versioning information to be at the end of the library filename rather than requiring
    981 that any such strings appear before the final element of the library name.</p>
    982 <p class="tent">The decision to standardize on <b>so</b> as a required element in a shared library name was intentional, as the
    983 alternative would have been standardizing things such as a new make macro $(SHLIB_EXT) that would otherwise be needed to write a
    984 portable makefile that can compile shared libraries despite not having a standardized element name.</p>
    985 <p class="tent">If a combination of direct and indirect dependencies of a shared library would require different versions of
    986 another shared library, options that are not specified by the standard (such as <b>-B direct</b>) will probably need to be used
    987 when linking that shared library, so that at runtime the intended versions are found.</p>
    988 </blockquote>
    989 <h4 class="mansect"><a name="tag_20_11_19" id="tag_20_11_19"></a>FUTURE DIRECTIONS</h4>
    990 <blockquote>
    991 <p>If this utility is directed to display a pathname that contains any bytes that have the encoded value of a &lt;newline&gt;
    992 character when &lt;newline&gt; is a terminator or separator in the output format being used, implementations are encouraged to
    993 treat this as an error. A future version of this standard may require implementations to treat this as an error.</p>
    994 <p class="tent">If this utility is directed to create a new directory entry that contains any bytes that have the encoded value of
    995 a &lt;newline&gt; character, implementations are encouraged to treat this as an error. A future version of this standard may
    996 require implementations to treat this as an error.</p>
    997 <p class="tent">Unlike all of the other non-OB-shaded utilities in this standard, a utility by this name probably will not appear
    998 in the next version of this standard. This utility's name is tied to the current revision of the ISO&nbsp;C standard at the time
    999 this standard is approved. Since the ISO&nbsp;C standard and this standard are maintained by different organizations on different
   1000 schedules, we cannot predict what the compiler will be named in the next version of the standard.</p>
   1001 </blockquote>
   1002 <h4 class="mansect"><a name="tag_20_11_20" id="tag_20_11_20"></a>SEE ALSO</h4>
   1003 <blockquote>
   1004 <p><a href="../utilities/V3_chap01.html#tag_18_01_01_04"><i>1.1.1.4 File Read, Write, and Creation</i></a> , <a href=
   1005 "../utilities/ar.html#"><i>ar</i></a> , <a href="../utilities/getconf.html#"><i>getconf</i></a> , <a href=
   1006 "../utilities/make.html#"><i>make</i></a> , <a href="../utilities/nm.html#"><i>nm</i></a> , <a href=
   1007 "../utilities/strip.html#"><i>strip</i></a> , <a href="../utilities/umask.html#tag_20_132"><i>umask</i></a></p>
   1008 <p class="tent">XBD <a href="../basedefs/V1_chap08.html#tag_08"><i>8. Environment Variables</i></a> , <a href=
   1009 "../basedefs/V1_chap12.html#tag_12_02"><i>12.2 Utility Syntax Guidelines</i></a> , <a href=
   1010 "../basedefs/V1_chap14.html#tag_14"><i>14. Headers</i></a></p>
   1011 <p class="tent">XSH <a href="../functions/exec.html#tag_17_129"><i>exec</i></a> , <a href=
   1012 "../functions/sysconf.html#"><i>sysconf</i></a></p>
   1013 </blockquote>
   1014 <h4 class="mansect"><a name="tag_20_11_21" id="tag_20_11_21"></a>CHANGE HISTORY</h4>
   1015 <blockquote>
   1016 <p>First released in Issue 8. Included for alignment with the ISO/IEC&nbsp;9899:2018 standard.</p>
   1017 </blockquote>
   1018 <div class="box"><em>End of informative text.</em></div>
   1019 <hr>
   1020 <p>&nbsp;</p>
   1021 <a href="#top"><span class="topOfPage">return to top of page</span></a><br>
   1022 <hr size="2" noshade>
   1023 <center><font size="2">UNIX® is a registered Trademark of The Open Group.<br>
   1024 POSIX™ is a Trademark of The IEEE.<br>
   1025 Copyright © 2001-2024 The IEEE and The Open Group, All Rights Reserved<br>
   1026 [ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
   1027 "../functions/contents.html">XSH</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../xrat/contents.html">XRAT</a>
   1028 ]</font></center>
   1029 <hr size="2" noshade>
   1030 <div class="NAVHEADER">
   1031 <table summary="Header navigation table" class="nav" width="100%" border="0" cellpadding="0" cellspacing="0">
   1032 <tr class="nav">
   1033 <td class="nav" width="15%" align="left" valign="bottom"><a href="../utilities/bg.html" accesskey="P">&lt;&lt;&lt;
   1034 Previous</a></td>
   1035 <td class="nav" width="70%" align="center" valign="bottom"><a href="contents.html">Home</a></td>
   1036 <td class="nav" width="15%" align="right" valign="bottom"><a href="../utilities/cal.html" accesskey="N">Next &gt;&gt;&gt;</a></td>
   1037 </tr>
   1038 </table>
   1039 <hr align="left" width="100%"></div>
   1040 </body>
   1041 </html>