blob: 2706ad89f854851deb7768f92da3d61b7d47ec28 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1999-2014 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Funding Free Software", the Front-Cover
Texts being (a) (see below), and with the Back-Cover Texts being (b)
(see below). A copy of the license is included in the section entitled
"GNU Free Documentation License".
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development. -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>The GNU Fortran Compiler: ISO_C_BINDING</title>
<meta name="description" content="The GNU Fortran Compiler: ISO_C_BINDING">
<meta name="keywords" content="The GNU Fortran Compiler: ISO_C_BINDING">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Intrinsic-Modules.html#Intrinsic-Modules" rel="up" title="Intrinsic Modules">
<link href="OpenMP-Modules-OMP_005fLIB-and-OMP_005fLIB_005fKINDS.html#OpenMP-Modules-OMP_005fLIB-and-OMP_005fLIB_005fKINDS" rel="next" title="OpenMP Modules OMP_LIB and OMP_LIB_KINDS">
<link href="ISO_005fFORTRAN_005fENV.html#ISO_005fFORTRAN_005fENV" rel="prev" title="ISO_FORTRAN_ENV">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="ISO_005fC_005fBINDING"></a>
<div class="header">
<p>
Next: <a href="OpenMP-Modules-OMP_005fLIB-and-OMP_005fLIB_005fKINDS.html#OpenMP-Modules-OMP_005fLIB-and-OMP_005fLIB_005fKINDS" accesskey="n" rel="next">OpenMP Modules OMP_LIB and OMP_LIB_KINDS</a>, Previous: <a href="ISO_005fFORTRAN_005fENV.html#ISO_005fFORTRAN_005fENV" accesskey="p" rel="prev">ISO_FORTRAN_ENV</a>, Up: <a href="Intrinsic-Modules.html#Intrinsic-Modules" accesskey="u" rel="up">Intrinsic Modules</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="ISO_005fC_005fBINDING-1"></a>
<h3 class="section">9.2 <code>ISO_C_BINDING</code></h3>
<dl compact="compact">
<dt><em>Standard</em>:</dt>
<dd><p>Fortran 2003 and later, GNU extensions
</p></dd>
</dl>
<p>The following intrinsic procedures are provided by the module; their
definition can be found in the section Intrinsic Procedures of this
manual.
</p>
<dl compact="compact">
<dt><code>C_ASSOCIATED</code></dt>
<dt><code>C_F_POINTER</code></dt>
<dt><code>C_F_PROCPOINTER</code></dt>
<dt><code>C_FUNLOC</code></dt>
<dt><code>C_LOC</code></dt>
<dt><code>C_SIZEOF</code></dt>
</dl>
<p>The <code>ISO_C_BINDING</code> module provides the following named constants of
type default integer, which can be used as KIND type parameters.
</p>
<p>In addition to the integer named constants required by the Fortran 2003
standard and <code>C_PTRDIFF_T</code> of TS 29113, GNU Fortran provides as an
extension named constants for the 128-bit integer types supported by the
C compiler: <code>C_INT128_T, C_INT_LEAST128_T, C_INT_FAST128_T</code>.
Furthermore, if <code>__float128</code> is supported in C, the named constants
<code>C_FLOAT128, C_FLOAT128_COMPLEX</code> are defined.
</p>
<table>
<tr><td width="15%">Fortran Type</td><td width="35%">Named constant</td><td width="35%">C type</td><td width="35%">Extension</td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT</code></td><td width="35%"><code>int</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_SHORT</code></td><td width="35%"><code>short int</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_LONG</code></td><td width="35%"><code>long int</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_LONG_LONG</code></td><td width="35%"><code>long long int</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_SIGNED_CHAR</code></td><td width="35%"><code>signed char</code>/<code>unsigned char</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_SIZE_T</code></td><td width="35%"><code>size_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT8_T</code></td><td width="35%"><code>int8_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT16_T</code></td><td width="35%"><code>int16_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT32_T</code></td><td width="35%"><code>int32_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT64_T</code></td><td width="35%"><code>int64_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT128_T</code></td><td width="35%"><code>int128_t</code></td><td width="35%">Ext.</td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_LEAST8_T</code></td><td width="35%"><code>int_least8_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_LEAST16_T</code></td><td width="35%"><code>int_least16_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_LEAST32_T</code></td><td width="35%"><code>int_least32_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_LEAST64_T</code></td><td width="35%"><code>int_least64_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_LEAST128_T</code></td><td width="35%"><code>int_least128_t</code></td><td width="35%">Ext.</td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_FAST8_T</code></td><td width="35%"><code>int_fast8_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_FAST16_T</code></td><td width="35%"><code>int_fast16_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_FAST32_T</code></td><td width="35%"><code>int_fast32_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_FAST64_T</code></td><td width="35%"><code>int_fast64_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INT_FAST128_T</code></td><td width="35%"><code>int_fast128_t</code></td><td width="35%">Ext.</td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INTMAX_T</code></td><td width="35%"><code>intmax_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_INTPTR_T</code></td><td width="35%"><code>intptr_t</code></td></tr>
<tr><td width="15%"><code>INTEGER</code></td><td width="35%"><code>C_PTRDIFF_T</code></td><td width="35%"><code>intptr_t</code></td><td width="35%">TS 29113</td></tr>
<tr><td width="15%"><code>REAL</code></td><td width="35%"><code>C_FLOAT</code></td><td width="35%"><code>float</code></td></tr>
<tr><td width="15%"><code>REAL</code></td><td width="35%"><code>C_DOUBLE</code></td><td width="35%"><code>double</code></td></tr>
<tr><td width="15%"><code>REAL</code></td><td width="35%"><code>C_LONG_DOUBLE</code></td><td width="35%"><code>long double</code></td></tr>
<tr><td width="15%"><code>REAL</code></td><td width="35%"><code>C_FLOAT128</code></td><td width="35%"><code>__float128</code></td><td width="35%">Ext.</td></tr>
<tr><td width="15%"><code>COMPLEX</code></td><td width="35%"><code>C_FLOAT_COMPLEX</code></td><td width="35%"><code>float _Complex</code></td></tr>
<tr><td width="15%"><code>COMPLEX</code></td><td width="35%"><code>C_DOUBLE_COMPLEX</code></td><td width="35%"><code>double _Complex</code></td></tr>
<tr><td width="15%"><code>COMPLEX</code></td><td width="35%"><code>C_LONG_DOUBLE_COMPLEX</code></td><td width="35%"><code>long double _Complex</code></td></tr>
<tr><td width="15%"><code>REAL</code></td><td width="35%"><code>C_FLOAT128_COMPLEX</code></td><td width="35%"><code>__float128 _Complex</code></td><td width="35%">Ext.</td></tr>
<tr><td width="15%"><code>LOGICAL</code></td><td width="35%"><code>C_BOOL</code></td><td width="35%"><code>_Bool</code></td></tr>
<tr><td width="15%"><code>CHARACTER</code></td><td width="35%"><code>C_CHAR</code></td><td width="35%"><code>char</code></td></tr>
</table>
<p>Additionally, the following parameters of type <code>CHARACTER(KIND=C_CHAR)</code>
are defined.
</p>
<table>
<tr><td width="20%">Name</td><td width="45%">C definition</td><td width="15%">Value</td></tr>
<tr><td width="20%"><code>C_NULL_CHAR</code></td><td width="45%">null character</td><td width="15%"><code>'\0'</code></td></tr>
<tr><td width="20%"><code>C_ALERT</code></td><td width="45%">alert</td><td width="15%"><code>'\a'</code></td></tr>
<tr><td width="20%"><code>C_BACKSPACE</code></td><td width="45%">backspace</td><td width="15%"><code>'\b'</code></td></tr>
<tr><td width="20%"><code>C_FORM_FEED</code></td><td width="45%">form feed</td><td width="15%"><code>'\f'</code></td></tr>
<tr><td width="20%"><code>C_NEW_LINE</code></td><td width="45%">new line</td><td width="15%"><code>'\n'</code></td></tr>
<tr><td width="20%"><code>C_CARRIAGE_RETURN</code></td><td width="45%">carriage return</td><td width="15%"><code>'\r'</code></td></tr>
<tr><td width="20%"><code>C_HORIZONTAL_TAB</code></td><td width="45%">horizontal tab</td><td width="15%"><code>'\t'</code></td></tr>
<tr><td width="20%"><code>C_VERTICAL_TAB</code></td><td width="45%">vertical tab</td><td width="15%"><code>'\v'</code></td></tr>
</table>
<p>Moreover, the following two named constants are defined:
</p>
<table>
<tr><td width="20%">Name</td><td width="80%">Type</td></tr>
<tr><td width="20%"><code>C_NULL_PTR</code></td><td width="80%"><code>C_PTR</code></td></tr>
<tr><td width="20%"><code>C_NULL_FUNPTR</code></td><td width="80%"><code>C_FUNPTR</code></td></tr>
</table>
<p>Both are equivalent to the value <code>NULL</code> in C.
</p>
<hr>
<div class="header">
<p>
Next: <a href="OpenMP-Modules-OMP_005fLIB-and-OMP_005fLIB_005fKINDS.html#OpenMP-Modules-OMP_005fLIB-and-OMP_005fLIB_005fKINDS" accesskey="n" rel="next">OpenMP Modules OMP_LIB and OMP_LIB_KINDS</a>, Previous: <a href="ISO_005fFORTRAN_005fENV.html#ISO_005fFORTRAN_005fENV" accesskey="p" rel="prev">ISO_FORTRAN_ENV</a>, Up: <a href="Intrinsic-Modules.html#Intrinsic-Modules" accesskey="u" rel="up">Intrinsic Modules</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>