Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / ext / compilation.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="ext.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="ext.html" title='Extending and Embedding the Python Interpreter' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='last' href='about.html' title='About this document...' />
10<link rel='help' href='about.html' title='About this document...' />
11<link rel="next" href="callingPython.html" />
12<link rel="prev" href="methodTable.html" />
13<link rel="parent" href="intro.html" />
14<link rel="next" href="callingPython.html" />
15<meta name='aesop' content='information' />
16<title>1.5 Compilation and Linkage
17</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.4 The Module's Method"
25 href="methodTable.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. Extending Python with"
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.6 Calling Python Functions"
31 href="callingPython.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Extending and Embedding the Python Interpreter</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'><img src='../icons/blank.png'
40 border='0' height='32' alt='' width='32' /></td>
41</tr></table>
42<div class='online-navigation'>
43<b class="navlabel">Previous:</b>
44<a class="sectref" rel="prev" href="methodTable.html">1.4 The Module's Method</A>
45<b class="navlabel">Up:</b>
46<a class="sectref" rel="parent" href="intro.html">1. Extending Python with</A>
47<b class="navlabel">Next:</b>
48<a class="sectref" rel="next" href="callingPython.html">1.6 Calling Python Functions</A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H1><A NAME="SECTION003500000000000000000"></A><A NAME="compilation"></A>
55<BR>
561.5 Compilation and Linkage
57
58</H1>
59
60<P>
61There are two more things to do before you can use your new extension:
62compiling and linking it with the Python system. If you use dynamic
63loading, the details may depend on the style of dynamic loading your
64system uses; see the chapters about building extension modules
65(chapter <A href="building.html#building">3</A>) and additional information that pertains only
66to building on Windows (chapter <A href="building-on-windows.html#building-on-windows">4</A>) for more
67information about this.
68
69<P>
70If you can't use dynamic loading, or if you want to make your module a
71permanent part of the Python interpreter, you will have to change the
72configuration setup and rebuild the interpreter. Luckily, this is
73very simple on <span class="Unix">Unix</span>: just place your file (<span class="file">spammodule.c</span> for
74example) in the <span class="file">Modules/</span> directory of an unpacked source
75distribution, add a line to the file <span class="file">Modules/Setup.local</span>
76describing your file:
77
78<P>
79<div class="verbatim"><pre>
80spam spammodule.o
81</pre></div>
82
83<P>
84and rebuild the interpreter by running <b class="program">make</b> in the toplevel
85directory. You can also run <b class="program">make</b> in the <span class="file">Modules/</span>
86subdirectory, but then you must first rebuild <span class="file">Makefile</span>
87there by running `<b class="program">make</b> Makefile'. (This is necessary each
88time you change the <span class="file">Setup</span> file.)
89
90<P>
91If your module requires additional libraries to link with, these can
92be listed on the line in the configuration file as well, for instance:
93
94<P>
95<div class="verbatim"><pre>
96spam spammodule.o -lX11
97</pre></div>
98
99<P>
100
101<DIV CLASS="navigation">
102<div class='online-navigation'>
103<p></p><hr />
104<table align="center" width="100%" cellpadding="0" cellspacing="2">
105<tr>
106<td class='online-navigation'><a rel="prev" title="1.4 The Module's Method"
107 href="methodTable.html"><img src='../icons/previous.png'
108 border='0' height='32' alt='Previous Page' width='32' /></A></td>
109<td class='online-navigation'><a rel="parent" title="1. Extending Python with"
110 href="intro.html"><img src='../icons/up.png'
111 border='0' height='32' alt='Up One Level' width='32' /></A></td>
112<td class='online-navigation'><a rel="next" title="1.6 Calling Python Functions"
113 href="callingPython.html"><img src='../icons/next.png'
114 border='0' height='32' alt='Next Page' width='32' /></A></td>
115<td align="center" width="100%">Extending and Embedding the Python Interpreter</td>
116<td class='online-navigation'><a rel="contents" title="Table of Contents"
117 href="contents.html"><img src='../icons/contents.png'
118 border='0' height='32' alt='Contents' width='32' /></A></td>
119<td class='online-navigation'><img src='../icons/blank.png'
120 border='0' height='32' alt='' width='32' /></td>
121<td class='online-navigation'><img src='../icons/blank.png'
122 border='0' height='32' alt='' width='32' /></td>
123</tr></table>
124<div class='online-navigation'>
125<b class="navlabel">Previous:</b>
126<a class="sectref" rel="prev" href="methodTable.html">1.4 The Module's Method</A>
127<b class="navlabel">Up:</b>
128<a class="sectref" rel="parent" href="intro.html">1. Extending Python with</A>
129<b class="navlabel">Next:</b>
130<a class="sectref" rel="next" href="callingPython.html">1.6 Calling Python Functions</A>
131</div>
132</div>
133<hr />
134<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
135</DIV>
136<!--End of Navigation Panel-->
137<ADDRESS>
138See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
139</ADDRESS>
140</BODY>
141</HTML>