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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="ext.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="ext.html" title='Extending and Embedding the Python Interpreter' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="embeddingInCplusplus.html" />
<link rel="parent" href="embedding.html" />
<link rel="next" href="reporting-bugs.html" />
<meta name='aesop' content='information' />
<title>5.6 Linking Requirements </title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="5.5 Embedding Python in"
href="embeddingInCplusplus.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="5. Embedding Python in"
href="embedding.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="A. Reporting Bugs"
href="reporting-bugs.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Extending and Embedding the Python Interpreter</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="embeddingInCplusplus.html">5.5 Embedding Python in</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="embedding.html">5. Embedding Python in</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="reporting-bugs.html">A. Reporting Bugs</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION007600000000000000000"></A><A NAME="link-reqs"></A>
<BR>
5.6 Linking Requirements
</H1>
<P>
While the <b class="program">configure</b> script shipped with the Python sources
will correctly build Python to export the symbols needed by
dynamically linked extensions, this is not automatically inherited by
applications which embed the Python library statically, at least on
<span class="Unix">Unix</span>. This is an issue when the application is linked to the static
runtime library (<span class="file">libpython.a</span>) and needs to load dynamic
extensions (implemented as <span class="file">.so</span> files).
<P>
The problem is that some entry points are defined by the Python
runtime solely for extension modules to use. If the embedding
application does not use any of these entry points, some linkers will
not include those entries in the symbol table of the finished
executable. Some additional options are needed to inform the linker
not to remove these symbols.
<P>
Determining the right options to use for any given platform can be
quite difficult, but fortunately the Python configuration already has
those values. To retrieve them from an installed Python interpreter,
start an interactive interpreter and have a short session like this:
<P>
<div class="verbatim"><pre>
&gt;&gt;&gt; import distutils.sysconfig
&gt;&gt;&gt; distutils.sysconfig.get_config_var('LINKFORSHARED')
'-Xlinker -export-dynamic'
</pre></div>
<a id='l2h-15' xml:id='l2h-15'></a>
<P>
The contents of the string presented will be the options that should
be used. If the string is empty, there's no need to add any
additional options. The <tt class="constant">LINKFORSHARED</tt> definition
corresponds to the variable of the same name in Python's top-level
<span class="file">Makefile</span>.
<P>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="5.5 Embedding Python in"
href="embeddingInCplusplus.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="5. Embedding Python in"
href="embedding.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="A. Reporting Bugs"
href="reporting-bugs.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Extending and Embedding the Python Interpreter</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><img src='../icons/blank.png'
border='0' height='32' alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="embeddingInCplusplus.html">5.5 Embedding Python in</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="embedding.html">5. Embedding Python in</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="reporting-bugs.html">A. Reporting Bugs</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>