Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / api / includes.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="api.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="api.html" title='Python/C API Reference Manual' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="objects.html" />
13<link rel="prev" href="intro.html" />
14<link rel="parent" href="intro.html" />
15<link rel="next" href="objects.html" />
16<meta name='aesop' content='information' />
17<title>1.1 Include Files </title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="1. Introduction"
25 href="intro.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="1. Introduction"
28 href="intro.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="1.2 Objects, Types and"
31 href="objects.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python/C API Reference Manual</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><img src='../icons/blank.png'
38 border='0' height='32' alt='' width='32' /></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="intro.html">1. Introduction</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="intro.html">1. Introduction</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="objects.html">1.2 Objects, Types and</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION003100000000000000000"></A><A NAME="includes"></A>
56<BR>
571.1 Include Files
58</H1>
59
60<P>
61All function, type and macro definitions needed to use the Python/C
62API are included in your code by the following line:
63
64<P>
65<div class="verbatim"><pre>
66#include "Python.h"
67</pre></div>
68
69<P>
70This implies inclusion of the following standard headers:
71<code>&lt;stdio.h&gt;</code>, <code>&lt;string.h&gt;</code>, <code>&lt;errno.h&gt;</code>,
72<code>&lt;limits.h&gt;</code>, and <code>&lt;stdlib.h&gt;</code> (if available).
73
74<P>
75<div class="warning"><b class="label">Warning:</b>
76
77 Since Python may define some pre-processor definitions which affect
78 the standard headers on some systems, you <em>must</em> include
79 <span class="file">Python.h</span> before any standard headers are included.
80</div>
81
82<P>
83All user visible names defined by Python.h (except those defined by
84the included standard headers) have one of the prefixes "<tt class="samp">Py</tt>" or
85"<tt class="samp">_Py</tt>". Names beginning with "<tt class="samp">_Py</tt>" are for internal use by
86the Python implementation and should not be used by extension writers.
87Structure member names do not have a reserved prefix.
88
89<P>
90<strong>Important:</strong> user code should never define names that begin
91with "<tt class="samp">Py</tt>" or "<tt class="samp">_Py</tt>". This confuses the reader, and
92jeopardizes the portability of the user code to future Python
93versions, which may define additional names beginning with one of
94these prefixes.
95
96<P>
97The header files are typically installed with Python. On <span class="Unix">Unix</span>, these
98are located in the directories
99<span class="file"><a class="envvar" id='l2h-1' xml:id='l2h-1'>prefix</a>/include/python<var>version</var>/</span> and
100<span class="file"><a class="envvar" id='l2h-2' xml:id='l2h-2'>exec_prefix</a>/include/python<var>version</var>/</span>, where
101<a class="envvar" id='l2h-4' xml:id='l2h-4'>prefix</a> and <a class="envvar" id='l2h-5' xml:id='l2h-5'>exec_prefix</a> are defined by the
102corresponding parameters to Python's <b class="program">configure</b> script and
103<var>version</var> is <code>sys.version[:3]</code>. On Windows, the headers are
104installed in <span class="file"><a class="envvar" id='l2h-3' xml:id='l2h-3'>prefix</a>/include</span>, where <a class="envvar" id='l2h-6' xml:id='l2h-6'>prefix</a> is
105the installation directory specified to the installer.
106
107<P>
108To include the headers, place both directories (if different) on your
109compiler's search path for includes. Do <em>not</em> place the parent
110directories on the search path and then use
111"<tt class="samp">#include &lt;python2.4/Python.h&gt;</tt>"; this will break on
112multi-platform builds since the platform independent headers under
113<a class="envvar" id='l2h-7' xml:id='l2h-7'>prefix</a> include the platform specific headers from
114<a class="envvar" id='l2h-8' xml:id='l2h-8'>exec_prefix</a>.
115
116<P>
117C++ users should note that though the API is defined entirely using
118C, the header files do properly declare the entry points to be
119<code>extern "C"</code>, so there is no need to do anything special to use
120the API from C++.
121
122<P>
123
124<DIV CLASS="navigation">
125<div class='online-navigation'>
126<p></p><hr />
127<table align="center" width="100%" cellpadding="0" cellspacing="2">
128<tr>
129<td class='online-navigation'><a rel="prev" title="1. Introduction"
130 href="intro.html"><img src='../icons/previous.png'
131 border='0' height='32' alt='Previous Page' width='32' /></A></td>
132<td class='online-navigation'><a rel="parent" title="1. Introduction"
133 href="intro.html"><img src='../icons/up.png'
134 border='0' height='32' alt='Up One Level' width='32' /></A></td>
135<td class='online-navigation'><a rel="next" title="1.2 Objects, Types and"
136 href="objects.html"><img src='../icons/next.png'
137 border='0' height='32' alt='Next Page' width='32' /></A></td>
138<td align="center" width="100%">Python/C API Reference Manual</td>
139<td class='online-navigation'><a rel="contents" title="Table of Contents"
140 href="contents.html"><img src='../icons/contents.png'
141 border='0' height='32' alt='Contents' width='32' /></A></td>
142<td class='online-navigation'><img src='../icons/blank.png'
143 border='0' height='32' alt='' width='32' /></td>
144<td class='online-navigation'><a rel="index" title="Index"
145 href="genindex.html"><img src='../icons/index.png'
146 border='0' height='32' alt='Index' width='32' /></A></td>
147</tr></table>
148<div class='online-navigation'>
149<b class="navlabel">Previous:</b>
150<a class="sectref" rel="prev" href="intro.html">1. Introduction</A>
151<b class="navlabel">Up:</b>
152<a class="sectref" rel="parent" href="intro.html">1. Introduction</A>
153<b class="navlabel">Next:</b>
154<a class="sectref" rel="next" href="objects.html">1.2 Objects, Types and</A>
155</div>
156</div>
157<hr />
158<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
159</DIV>
160<!--End of Navigation Panel-->
161<ADDRESS>
162See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
163</ADDRESS>
164</BODY>
165</HTML>