970 lines
37 KiB
HTML
970 lines
37 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>c99</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="c99"></a> <a name="tag_04_12"></a><!-- c99 -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_04_12_01"></a>NAME</h4>
|
|
|
|
<blockquote>c99 - compile standard C programs</blockquote>
|
|
|
|
<h4><a name="tag_04_12_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('CD')">CD</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> c99</tt> <b>[</b><tt>-c</tt><b>][</b><tt>-D</tt>
|
|
<i>name</i><b>[</b><tt>=</tt><i>value</i><b>]]</b><tt>...</tt><b>[</b><tt>-E</tt><b>][</b><tt>-g</tt><b>][</b><tt>-I</tt>
|
|
<i>directory</i><b>]</b> <tt>...</tt> <b>[</b><tt>-L</tt> <i>directory</i><b>]</b><tt><br>
|
|
...</tt> <b>[</b><tt>-o</tt>
|
|
<i>outfile</i><b>][</b><tt>-O</tt><i>optlevel</i><b>][</b><tt>-s</tt><b>][</b><tt>-U</tt> <i>name</i><b>]</b><tt>...</tt>
|
|
<i>operand</i> <tt>... <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>c99</i> utility is an interface to the standard C compilation system; it shall accept source code conforming to the
|
|
ISO C standard. The system conceptually consists of a compiler and link editor. The files referenced by <i>operand</i>s shall
|
|
be compiled and linked to produce an executable file. (It is unspecified whether the linking occurs entirely within the operation
|
|
of <i>c99</i>; some implementations may produce objects that are not fully resolved until the file is executed.)</p>
|
|
|
|
<p>If the <b>-c</b> option is specified, for all pathname operands of the form <i>file</i> <b>.c</b>, the files:</p>
|
|
|
|
<pre>
|
|
<tt>$(basename</tt> <i>pathname</i> <tt>.c).o
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>shall be created as the result of successful compilation. If the <b>-c</b> option is not specified, it is unspecified whether
|
|
such <b>.o</b> files are created or deleted for the <i>file</i> <b>.c</b> operands.</p>
|
|
|
|
<p>If there are no options that prevent link editing (such as <b>-c</b> or <b>-E</b>), and all operands compile and link without
|
|
error, the resulting executable file shall be written according to the <b>-o</b> <i>outfile</i> option (if present) or to the file
|
|
<b>a.out</b>.</p>
|
|
|
|
<p>The executable file shall be created as specified in <a href="xcu_chap01.html#tag_01_07_01_04"><i>File Read, Write, and
|
|
Creation</i></a> , except that the file permission bits shall be set to:</p>
|
|
|
|
<blockquote>
|
|
<pre>
|
|
S_IRWXO | S_IRWXG | S_IRWXU
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>and the bits specified by the <a href="../utilities/umask.html"><i>umask</i></a> of the process shall be cleared.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>c99</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>, except that:</p>
|
|
|
|
<ul>
|
|
<li>
|
|
<p>The <b>-l</b> <i>library</i> operands have the format of options, but their position within a list of operands affects the order
|
|
in which libraries are searched.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The order of specifying the <b>-I</b> and <b>-L</b> options is significant.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>Conforming applications shall specify each option separately; that is, grouping option letters (for example, <b>-cO</b>) need
|
|
not be recognized by all implementations.</p>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>The following options shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-c</b></dt>
|
|
|
|
<dd>Suppress the link-edit phase of the compilation, and do not remove any object files that are produced.</dd>
|
|
|
|
<dt><b>-g</b></dt>
|
|
|
|
<dd>Produce symbolic information in the object or executable files; the nature of this information is unspecified, and may be
|
|
modified by implementation-defined interactions with other options.</dd>
|
|
|
|
<dt><b>-s</b></dt>
|
|
|
|
<dd>Produce object or executable files, or both, from which symbolic and other information not required for proper execution using
|
|
the <i>exec</i> family defined in the System Interfaces volume of IEEE Std 1003.1-2001 has been removed (stripped). If
|
|
both <b>-g</b> and <b>-s</b> options are present, the action taken is unspecified.</dd>
|
|
|
|
<dt><b>-o </b> <i>outfile</i></dt>
|
|
|
|
<dd>Use the pathname <i>outfile</i>, instead of the default <b>a.out</b>, for the executable file produced. If the <b>-o</b> option
|
|
is present with <b>-c</b> or <b>-E</b>, the result is unspecified.</dd>
|
|
|
|
<dt><b>-D </b> <i>name</i><b>[=</b><i>value</i><b>]</b></dt>
|
|
|
|
<dd><br>
|
|
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
|
|
<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
|
|
<b>-D</b> option, <i>name</i> shall be undefined regardless of the order of the options. Additional implementation-defined
|
|
<i>name</i>s may be provided by the compiler. Implementations shall support at least 2048 bytes of <b>-D</b> definitions and 256
|
|
<i>names</i>.</dd>
|
|
|
|
<dt><b>-E</b></dt>
|
|
|
|
<dd>Copy C-language source files to standard output, expanding all preprocessor directives; no compilation shall be performed. If
|
|
any operand is not a text file, the effects are unspecified.</dd>
|
|
|
|
<dt><b>-I </b> <i>directory</i></dt>
|
|
|
|
<dd>Change the algorithm for searching for headers whose names are not absolute pathnames to look in the directory named by the
|
|
<i>directory</i> pathname before looking in the usual places. Thus, headers whose names are enclosed in double-quotes ( <tt>""</tt>
|
|
) 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>
|
|
options, and last in the usual places. For headers whose names are enclosed in angle brackets ( <tt>"<>"</tt> ), the header
|
|
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>
|
|
options shall be searched in the order specified. Implementations shall support at least ten instances of this option in a single
|
|
<i>c99</i> command invocation.</dd>
|
|
|
|
<dt><b>-L </b> <i>directory</i></dt>
|
|
|
|
<dd>Change the algorithm of searching for the libraries named in the <b>-l</b> objects to look in the directory named by the
|
|
<i>directory</i> pathname before looking in the usual places. Directories named in <b>-L</b> options shall be searched in the order
|
|
specified. Implementations shall support at least ten instances of this option in a single <i>c99</i> command invocation. If a
|
|
directory specified by a <b>-L</b> option contains files named <b>libc.a</b>, <b>libm.a</b>, <b>libl.a</b>, or <b>liby.a</b>, the
|
|
results are unspecified.</dd>
|
|
|
|
<dt><b>-O </b> <i>optlevel</i></dt>
|
|
|
|
<dd>Specify the level of code optimization. If the <i>optlevel</i> option-argument is the digit <tt>'0'</tt> , all special code
|
|
optimizations shall be disabled. If it is the digit <tt>'1'</tt> , the nature of the optimization is unspecified. If the <b>-O</b>
|
|
option is omitted, the nature of the system's default optimization is unspecified. It is unspecified whether code generated in the
|
|
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
|
|
supported.</dd>
|
|
|
|
<dt><b>-U </b> <i>name</i></dt>
|
|
|
|
<dd>Remove any initial definition of <i>name</i>.</dd>
|
|
</dl>
|
|
|
|
<p>Multiple instances of the <b>-D</b>, <b>-I</b>, <b>-U</b>, and <b>-L</b> options can be specified.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>An <i>operand</i> is either in the form of a pathname or the form <b>-l</b> <i>library</i>. The application shall ensure that at
|
|
least one operand of the pathname form is specified. The following operands shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>file.</i><b>c</b></dt>
|
|
|
|
<dd>A C-language source file to be compiled and optionally linked. The application shall ensure that the operand is of this form if
|
|
the <b>-c</b> option is used.</dd>
|
|
|
|
<dt><i>file.</i><b>a</b></dt>
|
|
|
|
<dd>A library of object files typically produced by the <a href="../utilities/ar.html"><i>ar</i></a> utility, and passed directly
|
|
to the link editor. Implementations may recognize implementation-defined suffixes other than <b>.a</b> as denoting object file
|
|
libraries.</dd>
|
|
|
|
<dt><i>file.</i><b>o</b></dt>
|
|
|
|
<dd>An object file produced by <i>c99</i> <b>-c</b> and passed directly to the link editor. Implementations may recognize
|
|
implementation-defined suffixes other than <b>.o</b> as denoting object files.</dd>
|
|
</dl>
|
|
|
|
<p>The processing of other files is implementation-defined.</p>
|
|
|
|
<dl compact>
|
|
<dt><i>-l library</i></dt>
|
|
|
|
<dd>(The letter ell.) Search the library named:
|
|
|
|
<pre>
|
|
<tt>lib</tt><i>library</i><tt>.a
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>A library shall be searched when its name is encountered, so the placement of a <b>-l</b> operand is significant. Several
|
|
standard libraries can be specified in this manner, as described in the EXTENDED DESCRIPTION section. Implementations may recognize
|
|
implementation-defined suffixes other than <b>.a</b> as denoting libraries.</p>
|
|
</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>Not used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>The input file shall be one of the following: a text file containing a C-language source program, an object file in the format
|
|
produced by <i>c99</i> <b>-c</b>, or a library of object files, in the format produced by archiving zero or more object files,
|
|
using <a href="../utilities/ar.html"><i>ar</i></a>. Implementations may supply additional utilities that produce files in these
|
|
formats. Additional input file formats are implementation-defined.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>c99</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
|
|
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
|
|
opposed to multi-byte characters in arguments and input files).</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard
|
|
error.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><i>TMPDIR</i></dt>
|
|
|
|
<dd>Provide a pathname that should override the default directory for temporary files, if any. <sup>[<a href=
|
|
"javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> On
|
|
XSI-conforming systems, provide a pathname that shall override the default directory for temporary files, if any. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>If more than one <i>file</i> operand ending in <b>.c</b> (or possibly other unspecified suffixes) is given, for each such
|
|
file:</p>
|
|
|
|
<pre>
|
|
<tt>"%s:\n", <</tt><i>file</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>may be written. These messages, if written, shall precede the processing of each input file; they shall not be written to the
|
|
standard output if they are written to the standard error, as described in the STDERR section.</p>
|
|
|
|
<p>If the <b>-E</b> option is specified, the standard output shall be a text file that represents the results of the preprocessing
|
|
stage of the language; it may contain extra information appropriate for subsequent compilation passes.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic messages. If more than one <i>file</i> operand ending in <b>.c</b> (or
|
|
possibly other unspecified suffixes) is given, for each such file:</p>
|
|
|
|
<pre>
|
|
<tt>"%s:\n", <</tt><i>file</i><tt>>
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>may be written to allow identification of the diagnostic and warning messages with the appropriate input file. These messages,
|
|
if written, shall precede the processing of each input file; they shall not be written to the standard error if they are written to
|
|
the standard output, as described in the STDOUT section.</p>
|
|
|
|
<p>This utility may produce warning messages about certain conditions that do not warrant returning an error (non-zero) exit
|
|
value.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>Object files or executable files or both are produced in unspecified formats.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<h5><a name="tag_04_12_13_01"></a>Standard Libraries</h5>
|
|
|
|
<p>The <i>c99</i> utility shall recognize the following <b>-l</b> operands for standard libraries:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-l c</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions referenced in the System Interfaces volume of IEEE Std 1003.1-2001,
|
|
with the possible exception of those functions listed as residing in <a href="../basedefs/aio.h.html"><i><aio.h></i></a>, <a
|
|
href="../basedefs/arpa/inet.h.html"><i><arpa/inet.h></i></a>, <a href="../basedefs/math.h.html"><i><math.h></i></a>, <a
|
|
href="../basedefs/mqueue.h.html"><i><mqueue.h></i></a>, <a href="../basedefs/netdb.h.html"><i><netdb.h></i></a>, <a
|
|
href="../basedefs/netinet/in.h.html"><i><netinet/in.h></i></a>, <a href=
|
|
"../basedefs/pthread.h.html"><i><pthread.h></i></a>, <a href="../basedefs/sched.h.html"><i><sched.h></i></a>, <a href=
|
|
"../basedefs/semaphore.h.html"><i><semaphore.h></i></a>, <a href="../basedefs/spawn.h.html"><i><spawn.h></i></a>, <a
|
|
href="../basedefs/sys/socket.h.html"><i><sys/socket.h></i></a>, <a href=
|
|
"../functions/pthread_kill.html"><i>pthread_kill</i>()</a>, and <a href=
|
|
"../functions/pthread_sigmask.html"><i>pthread_sigmask</i>()</a> in <a href=
|
|
"../basedefs/signal.h.html"><i><signal.h></i></a>, <a href="../basedefs/trace.h.html"><i><trace.h></i></a>, functions
|
|
marked as extensions other than as part of the MF or MPR extensions in <a href=
|
|
"../basedefs/sys/mman.h.html"><i><sys/mman.h></i></a>, functions marked as ADV in <a href=
|
|
"../basedefs/fcntl.h.html"><i><fcntl.h></i></a>, and functions marked as CS, CPT, and TMR in <a href=
|
|
"../basedefs/time.h.html"><i><time.h></i></a>. This operand shall not be required to be present to cause a search of this
|
|
library.</dd>
|
|
|
|
<dt><b>-l l</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions required by the C-language output of <a href=
|
|
"../utilities/lex.html"><i>lex</i></a> that are not made available through the <b>-l c</b> operand.</dd>
|
|
|
|
<dt><b>-l pthread</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions referenced in <a href="../basedefs/pthread.h.html"><i><pthread.h></i></a>
|
|
and <a href="../functions/pthread_kill.html"><i>pthread_kill</i>()</a> and <a href=
|
|
"../functions/pthread_sigmask.html"><i>pthread_sigmask</i>()</a> referenced in <a href=
|
|
"../basedefs/signal.h.html"><i><signal.h></i></a>. An implementation may search this library in the absence of this
|
|
operand.</dd>
|
|
|
|
<dt><b>-l m</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions referenced in <a href="../basedefs/math.h.html"><i><math.h></i></a>. An
|
|
implementation may search this library in the absence of this operand.</dd>
|
|
|
|
<dt><b>-l rt</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions referenced in <a href="../basedefs/aio.h.html"><i><aio.h></i></a>, <a href=
|
|
"../basedefs/mqueue.h.html"><i><mqueue.h></i></a>, <a href="../basedefs/sched.h.html"><i><sched.h></i></a>, <a href=
|
|
"../basedefs/semaphore.h.html"><i><semaphore.h></i></a>, and <a href="../basedefs/spawn.h.html"><i><spawn.h></i></a>,
|
|
functions marked as extensions other than as part of the MF or MPR extensions in <a href=
|
|
"../basedefs/sys/mman.h.html"><i><sys/mman.h></i></a>, functions marked as ADV in <a href=
|
|
"../basedefs/fcntl.h.html"><i><fcntl.h></i></a>, and functions marked as CS, CPT, and TMR in <a href=
|
|
"../basedefs/time.h.html"><i><time.h></i></a>. An implementation may search this library in the absence of this operand.</dd>
|
|
|
|
<dt><b>-l trace</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions referenced in <a href="../basedefs/trace.h.html"><i><trace.h></i></a>. An
|
|
implementation may search this library in the absence of this operand.</dd>
|
|
|
|
<dt><b>-l xnet</b></dt>
|
|
|
|
<dd>This operand makes visible all functions referenced in <a href="../basedefs/arpa/inet.h.html"><i><arpa/inet.h></i></a>,
|
|
<a href="../basedefs/netdb.h.html"><i><netdb.h></i></a>, <a href=
|
|
"../basedefs/netinet/in.h.html"><i><netinet/in.h></i></a>, and <a href=
|
|
"../basedefs/sys/socket.h.html"><i><sys/socket.h></i></a>. An implementation may search this library in the absence of this
|
|
operand.</dd>
|
|
|
|
<dt><b>-l y</b></dt>
|
|
|
|
<dd>This operand shall make visible all functions required by the C-language output of <a href=
|
|
"../utilities/yacc.html"><i>yacc</i></a> that are not made available through the <b>-l c</b> operand.</dd>
|
|
</dl>
|
|
|
|
<p>In the absence of options that inhibit invocation of the link editor, such as <b>-c</b> or <b>-E</b>, the <i>c99</i> utility
|
|
shall 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 files and libraries are loaded.</p>
|
|
|
|
<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>,
|
|
<b>liby.a</b>, or <b>libxnet</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_04_12_13_02"></a>External Symbols</h5>
|
|
|
|
<p>The C compiler and link editor shall support the significance of external symbols up to a length of at least 31 bytes; the
|
|
action taken upon encountering symbols exceeding the implementation-defined maximum symbol length is unspecified.</p>
|
|
|
|
<p>The compiler and link editor shall support a minimum of 511 external symbols per source or object file, and a minimum of 4095
|
|
external symbols in total. A diagnostic message shall be written to the standard output if the implementation-defined limit is
|
|
exceeded; other actions are unspecified.</p>
|
|
|
|
<h5><a name="tag_04_12_13_03"></a>Programming Environments</h5>
|
|
|
|
<p>All implementations shall support one of the following programming environments as a default. Implementations may support more
|
|
than one of the following programming environments. Applications can use <a href="../functions/sysconf.html"><i>sysconf</i>()</a>
|
|
or <a href="../utilities/getconf.html"><i>getconf</i></a> to determine which programming environments are supported.<br>
|
|
</p>
|
|
|
|
<center><b><a name="tagtcjh_11"></a> Table: Programming Environments: Type Sizes</b></center>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Programming Environment</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Bits in</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Bits in</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Bits in</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Bits in</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b><i>getconf</i> Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>int</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>long</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>pointer</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>off_t</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_ILP32_OFF32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_ILP32_OFFBIG</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">>=64</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_LP64_OFF64</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">64</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">64</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">64</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_LPBIG_OFFBIG</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">>=32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">>=64</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">>=64</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">>=64</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>All implementations shall support one or more environments where the widths of the following types are no greater than the width
|
|
of type <b>long</b>:</p>
|
|
|
|
<blockquote><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>, <b>ssize_t</b>, <b>suseconds_t</b>, <b>tcflag_t</b>, <b>useconds_t</b>, <b>wchar_t</b>, <b>wint_t</b></blockquote>
|
|
|
|
<p>The executable files created when these environments are selected shall be in a proper format for execution by the <i>exec</i>
|
|
family of functions. Each environment may be one of the ones in <a href="#tagtcjh_11">Programming Environments: Type Sizes</a> , or
|
|
it may be another environment. The names for the environments that meet this requirement shall be output by a <a href=
|
|
"../utilities/getconf.html"><i>getconf</i></a> command using the _POSIX_V6_WIDTH_RESTRICTED_ENVS argument. If more than one
|
|
environment meets the requirement, the names of all such environments shall be output on separate lines. Any of these names can
|
|
then be used in a subsequent <a href="../utilities/getconf.html"><i>getconf</i></a> command to obtain the flags specific to that
|
|
environment with the following suffixes added as appropriate:</p>
|
|
|
|
<dl compact>
|
|
<dt>_CFLAGS</dt>
|
|
|
|
<dd>To get the C compiler flags.</dd>
|
|
|
|
<dt>_LDFLAGS</dt>
|
|
|
|
<dd>To get the linker/loader flags.</dd>
|
|
|
|
<dt>_LIBS</dt>
|
|
|
|
<dd>To get the libraries.</dd>
|
|
</dl>
|
|
|
|
<p>This requirement may be removed in a future version of IEEE Std 1003.1.</p>
|
|
|
|
<p>When this utility processes a file containing a function called <i>main</i>(), it shall be defined with a return type equivalent
|
|
to <b>int</b>. Using return from the initial call to <i>main</i>() shall be equivalent (other than with respect to language scope
|
|
issues) to calling <a href="../functions/exit.html"><i>exit</i>()</a> with the returned value. Reaching the end of the initial call
|
|
to <i>main</i>() shall be equivalent to calling <i>exit</i>(0). The implementation shall not declare a prototype for this
|
|
function.</p>
|
|
|
|
<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 environment rather than the implementation default programming
|
|
environment while compiling, the application shall first verify that the implementation supports the desired environment. If the
|
|
desired programming environment is supported, the application shall then invoke <i>c99</i> with the appropriate C compiler flags as
|
|
the first options for the compile, the appropriate linker/loader flags after any other options but before any operands, and the
|
|
appropriate libraries at the end of the operands.</p>
|
|
|
|
<p>Conforming applications shall not attempt to link together object files compiled for different programming models. Applications
|
|
shall also be aware that binary data placed in shared memory or in files might not be recognized by applications built for other
|
|
programming models.<br>
|
|
</p>
|
|
|
|
<center><b>Table: Programming Environments: <i>c99</i> and <i>cc</i> Arguments</b></center>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Programming Environment</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b> </b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b><i>c99</i> and <i>cc</i> Arguments</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b><i>getconf</i> Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Use</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b><i>getconf</i> Name</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_ILP32_OFF32</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">C Compiler Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_ILP32_OFF32_CFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Linker/Loader Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_ILP32_OFF32_LDFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Libraries</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_ILP32_OFF32_LIBS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_ILP32_OFFBIG</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">C Compiler Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_ILP32_OFFBIG_CFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Linker/Loader Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_ILP32_OFFBIG_LDFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Libraries</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_ILP32_OFFBIG_LIBS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_LP64_OFF64</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">C Compiler Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_LP64_OFF64_CFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Linker/Loader Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_LP64_OFF64_LDFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Libraries</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_LP64_OFF64_LIBS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">_POSIX_V6_LPBIG_OFFBIG</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">C Compiler Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_LPBIG_OFFBIG_CFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Linker/Loader Flags</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_LPBIG_OFFBIG_LDFLAGS</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"> </p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Libraries</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">POSIX_V6_LPBIG_OFFBIG_LIBS</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following exit values shall be returned:</p>
|
|
|
|
<dl compact>
|
|
<dt> 0</dt>
|
|
|
|
<dd>Successful compilation or link edit.</dd>
|
|
|
|
<dt>>0</dt>
|
|
|
|
<dd>An error occurred.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>When <i>c99</i> encounters a compilation error that causes an object file not to be created, it shall write a diagnostic to
|
|
standard error and continue to compile other source code operands, but it shall not perform the link phase and return a non-zero
|
|
exit status. If the link edit is unsuccessful, a diagnostic message shall be written to standard error and <i>c99</i> exits with a
|
|
non-zero status. A conforming application shall rely on the exit status of <i>c99</i>, rather than on the existence or mode of the
|
|
executable file.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_12_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>Since the <i>c99</i> utility usually creates files in the current directory during the compilation process, it is typically
|
|
necessary to run the <i>c99</i> utility in a directory in which a file can be created.</p>
|
|
|
|
<p>On systems providing POSIX Conformance (see the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap02.html#tag_02">Chapter 2, Conformance</a>), <i>c99</i> is required only with the C-Language Development
|
|
option; XSI-conformant systems always provide <i>c99</i>.</p>
|
|
|
|
<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 cannot rely on <b>.o</b> files being created, but it also must be
|
|
prepared for any related <b>.o</b> files that already exist being deleted at the completion of the link edit.</p>
|
|
|
|
<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 systems that do not behave like this, it is necessary for a conforming application to
|
|
supply all <b>-L</b> options before any of the <b>-l</b> options.</p>
|
|
|
|
<p>There is the possible implication that if a user supplies versions of the standard functions (before they would be encountered
|
|
by an implicit <b>-l c</b> or explicit <b>-l m</b>), that those versions would be used in place of the standard versions.
|
|
There are various reasons this might not be true (functions defined as macros, manipulations for clean name 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 explicitly stated to
|
|
produce unspecified behavior.</p>
|
|
|
|
<p>All of the functions specified in the System Interfaces volume of IEEE Std 1003.1-2001 may be made visible by
|
|
implementations when the Standard C Library is searched. Conforming applications must explicitly request searching the other
|
|
standard libraries when functions made visible by those libraries are used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<ol>
|
|
<li>
|
|
<p>The following usage example compiles <b>foo.c</b> and creates the executable file <b>foo</b>:</p>
|
|
|
|
<pre>
|
|
<tt>c99 -o foo foo.c
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The following usage example compiles <b>foo.c</b> and creates the object file <b>foo.o</b>:</p>
|
|
|
|
<pre>
|
|
<tt>c99 -c foo.c
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The following usage example compiles <b>foo.c</b> and creates the executable file <b>a.out</b>:</p>
|
|
|
|
<pre>
|
|
<tt>c99 foo.c
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The following usage example compiles <b>foo.c</b>, links it with <b>bar.o</b>, and creates the executable file <b>a.out</b>. It
|
|
may also create and leave <b>foo.o</b>:</p>
|
|
|
|
<pre>
|
|
<tt>c99 foo.c bar.o
|
|
</tt>
|
|
</pre>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The following example shows how an application using threads interfaces can test for support of and use a programming
|
|
environment supporting 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:</p>
|
|
|
|
<pre>
|
|
<tt>if [ $(getconf _POSIX_V6_ILP32_OFFBIG) != "-1" ]
|
|
then
|
|
c99 $(getconf POSIX_V6_ILP32_OFFBIG_CFLAGS) -D_XOPEN_SOURCE=600 \
|
|
$(getconf POSIX_V6_ILP32_OFFBIG_LDFLAGS) foo.c -o foo \
|
|
$(getconf POSIX_V6_ILP32_OFFBIG_LIBS) -l pthread
|
|
else
|
|
echo ILP32_OFFBIG programming environment not supported
|
|
exit 1
|
|
fi
|
|
</tt>
|
|
</pre>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The following examples clarify the use and interactions of <b>-L</b> options and <b>-l</b> operands.</p>
|
|
|
|
<p>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 command line to compile and
|
|
link in the desired way is:</p>
|
|
|
|
<pre>
|
|
<tt>c99 -L /a/b/c main.o a.c -l Q b.c -l p
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>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> and
|
|
<b>libp.a</b> reside in the same directory.</p>
|
|
|
|
<p>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>:</p>
|
|
|
|
<pre>
|
|
<tt>c99 -L /a/a/a -L /a/b/c main.o a.c -l Q b.c -l p
|
|
</tt>
|
|
</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>
|
|
</li>
|
|
|
|
<li>
|
|
<p>The following example shows how an application can use a programming environment where the widths of the following types:</p>
|
|
|
|
<blockquote><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>, <b>ssize_t</b>, <b>suseconds_t</b>, <b>tcflag_t</b>, <b>useconds_t</b>, <b>wchar_t</b>, <b>wint_t</b></blockquote>
|
|
|
|
<p>are no greater than the width of type <b>long</b>:</p>
|
|
|
|
<pre>
|
|
<tt># First choose one of the listed environments ...
|
|
<br>
|
|
# ... if there are no additional constraints, the first one will do:
|
|
CENV=$(getconf _POSIX_V6_WIDTH_RESTRICTED_ENVS | head -n l)
|
|
<br>
|
|
# ... or, if an environment that supports large files is preferred,
|
|
# look for names that contain "OFF64" or "OFFBIG". (This chooses
|
|
# the last one in the list if none match.)
|
|
for CENV in $(getconf _POSIX_V6_WIDTH_RESTRICTED_ENVS)
|
|
do
|
|
case $CENV in
|
|
*OFF64*|*OFFBIG*) break ;;
|
|
esac
|
|
done
|
|
<br>
|
|
# The chosen environment name can now be used like this:
|
|
<br>
|
|
c99 $(getconf ${CENV}_CFLAGS) -D _POSIX_C_SOURCE=200112L \
|
|
$(getconf ${CENV}_LDFLAGS) foo.c -o foo \
|
|
$(getconf ${CENV}_LIBS)
|
|
</tt>
|
|
</pre>
|
|
</li>
|
|
</ol>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>c99</i> utility is based on the <i>c89</i> utility originally introduced in the ISO POSIX-2:1993 standard.</p>
|
|
|
|
<p>Some of the changes from <i>c89</i> include the modification to the contents of the Standard Libraries section to account for
|
|
new headers and options; for example, <a href="../basedefs/spawn.h.html"><i><spawn.h></i></a> added to the <b>-l rt</b>
|
|
operand, and the <b>-l</b> trace operand added for the Tracing functions.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="xcu_chap01.html#tag_01_07_01_04"><i>File Read, Write, and Creation</i></a> , <a href="ar.html"><i>ar</i></a> , <a href=
|
|
"getconf.html"><i>getconf</i></a> , <a href="make.html"><i>make</i></a> , <a href="nm.html"><i>nm</i></a> , <a href=
|
|
"strip.html"><i>strip</i></a> , <a href="umask.html"><i>umask</i>()</a> , the System Interfaces volume of
|
|
IEEE Std 1003.1-2001, <i>exec</i>, <a href="../functions/sysconf.html"><i>sysconf</i>()</a>, the Base Definitions volume
|
|
of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap13.html#tag_13">Chapter 13, Headers</a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_12_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 6. Included for alignment with the ISO/IEC 9899:1999 standard.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|