Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / ext / link-reqs.html
CommitLineData
86530b38
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="prev" href="embeddingInCplusplus.html" />
12<link rel="parent" href="embedding.html" />
13<link rel="next" href="reporting-bugs.html" />
14<meta name='aesop' content='information' />
15<title>5.6 Linking Requirements </title>
16</head>
17<body>
18<DIV CLASS="navigation">
19<div id='top-navigation-panel' xml:id='top-navigation-panel'>
20<table align="center" width="100%" cellpadding="0" cellspacing="2">
21<tr>
22<td class='online-navigation'><a rel="prev" title="5.5 Embedding Python in"
23 href="embeddingInCplusplus.html"><img src='../icons/previous.png'
24 border='0' height='32' alt='Previous Page' width='32' /></A></td>
25<td class='online-navigation'><a rel="parent" title="5. Embedding Python in"
26 href="embedding.html"><img src='../icons/up.png'
27 border='0' height='32' alt='Up One Level' width='32' /></A></td>
28<td class='online-navigation'><a rel="next" title="A. Reporting Bugs"
29 href="reporting-bugs.html"><img src='../icons/next.png'
30 border='0' height='32' alt='Next Page' width='32' /></A></td>
31<td align="center" width="100%">Extending and Embedding the Python Interpreter</td>
32<td class='online-navigation'><a rel="contents" title="Table of Contents"
33 href="contents.html"><img src='../icons/contents.png'
34 border='0' height='32' alt='Contents' width='32' /></A></td>
35<td class='online-navigation'><img src='../icons/blank.png'
36 border='0' height='32' alt='' width='32' /></td>
37<td class='online-navigation'><img src='../icons/blank.png'
38 border='0' height='32' alt='' width='32' /></td>
39</tr></table>
40<div class='online-navigation'>
41<b class="navlabel">Previous:</b>
42<a class="sectref" rel="prev" href="embeddingInCplusplus.html">5.5 Embedding Python in</A>
43<b class="navlabel">Up:</b>
44<a class="sectref" rel="parent" href="embedding.html">5. Embedding Python in</A>
45<b class="navlabel">Next:</b>
46<a class="sectref" rel="next" href="reporting-bugs.html">A. Reporting Bugs</A>
47</div>
48<hr /></div>
49</DIV>
50<!--End of Navigation Panel-->
51
52<H1><A NAME="SECTION007600000000000000000"></A><A NAME="link-reqs"></A>
53<BR>
545.6 Linking Requirements
55
56</H1>
57
58<P>
59While the <b class="program">configure</b> script shipped with the Python sources
60will correctly build Python to export the symbols needed by
61dynamically linked extensions, this is not automatically inherited by
62applications which embed the Python library statically, at least on
63<span class="Unix">Unix</span>. This is an issue when the application is linked to the static
64runtime library (<span class="file">libpython.a</span>) and needs to load dynamic
65extensions (implemented as <span class="file">.so</span> files).
66
67<P>
68The problem is that some entry points are defined by the Python
69runtime solely for extension modules to use. If the embedding
70application does not use any of these entry points, some linkers will
71not include those entries in the symbol table of the finished
72executable. Some additional options are needed to inform the linker
73not to remove these symbols.
74
75<P>
76Determining the right options to use for any given platform can be
77quite difficult, but fortunately the Python configuration already has
78those values. To retrieve them from an installed Python interpreter,
79start an interactive interpreter and have a short session like this:
80
81<P>
82<div class="verbatim"><pre>
83&gt;&gt;&gt; import distutils.sysconfig
84&gt;&gt;&gt; distutils.sysconfig.get_config_var('LINKFORSHARED')
85'-Xlinker -export-dynamic'
86</pre></div>
87<a id='l2h-15' xml:id='l2h-15'></a>
88
89<P>
90The contents of the string presented will be the options that should
91be used. If the string is empty, there's no need to add any
92additional options. The <tt class="constant">LINKFORSHARED</tt> definition
93corresponds to the variable of the same name in Python's top-level
94<span class="file">Makefile</span>.
95
96<P>
97
98<DIV CLASS="navigation">
99<div class='online-navigation'>
100<p></p><hr />
101<table align="center" width="100%" cellpadding="0" cellspacing="2">
102<tr>
103<td class='online-navigation'><a rel="prev" title="5.5 Embedding Python in"
104 href="embeddingInCplusplus.html"><img src='../icons/previous.png'
105 border='0' height='32' alt='Previous Page' width='32' /></A></td>
106<td class='online-navigation'><a rel="parent" title="5. Embedding Python in"
107 href="embedding.html"><img src='../icons/up.png'
108 border='0' height='32' alt='Up One Level' width='32' /></A></td>
109<td class='online-navigation'><a rel="next" title="A. Reporting Bugs"
110 href="reporting-bugs.html"><img src='../icons/next.png'
111 border='0' height='32' alt='Next Page' width='32' /></A></td>
112<td align="center" width="100%">Extending and Embedding the Python Interpreter</td>
113<td class='online-navigation'><a rel="contents" title="Table of Contents"
114 href="contents.html"><img src='../icons/contents.png'
115 border='0' height='32' alt='Contents' width='32' /></A></td>
116<td class='online-navigation'><img src='../icons/blank.png'
117 border='0' height='32' alt='' width='32' /></td>
118<td class='online-navigation'><img src='../icons/blank.png'
119 border='0' height='32' alt='' width='32' /></td>
120</tr></table>
121<div class='online-navigation'>
122<b class="navlabel">Previous:</b>
123<a class="sectref" rel="prev" href="embeddingInCplusplus.html">5.5 Embedding Python in</A>
124<b class="navlabel">Up:</b>
125<a class="sectref" rel="parent" href="embedding.html">5. Embedding Python in</A>
126<b class="navlabel">Next:</b>
127<a class="sectref" rel="next" href="reporting-bugs.html">A. Reporting Bugs</A>
128</div>
129</div>
130<hr />
131<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
132</DIV>
133<!--End of Navigation Panel-->
134<ADDRESS>
135See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
136</ADDRESS>
137</BODY>
138</HTML>