Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-backports > by-pkgid > 3ba3bd1608c672ba2129b098a48e9e4d > files > 541

python3-docs-3.2.2-3mdv2010.2.noarch.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>4. Building C and C++ Extensions on Windows &mdash; Python v3.2.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '3.2.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v3.2.2 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v3.2.2 documentation" href="../index.html" />
    <link rel="up" title="Extending and Embedding the Python Interpreter" href="index.html" />
    <link rel="next" title="5. Embedding Python in Another Application" href="embedding.html" />
    <link rel="prev" title="3. Building C and C++ Extensions with distutils" href="building.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="embedding.html" title="5. Embedding Python in Another Application"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="building.html" title="3. Building C and C++ Extensions with distutils"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v3.2.2 documentation</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">Extending and Embedding the Python Interpreter</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="building-c-and-c-extensions-on-windows">
<span id="building-on-windows"></span><h1>4. Building C and C++ Extensions on Windows<a class="headerlink" href="#building-c-and-c-extensions-on-windows" title="Permalink to this headline">¶</a></h1>
<p>This chapter briefly explains how to create a Windows extension module for
Python using Microsoft Visual C++, and follows with more detailed background
information on how it works.  The explanatory material is useful for both the
Windows programmer learning to build Python extensions and the Unix programmer
interested in producing software which can be successfully built on both Unix
and Windows.</p>
<p>Module authors are encouraged to use the distutils approach for building
extension modules, instead of the one described in this section. You will still
need the C compiler that was used to build Python; typically Microsoft Visual
C++.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This chapter mentions a number of filenames that include an encoded Python
version number.  These filenames are represented with the version number shown
as <tt class="docutils literal"><span class="pre">XY</span></tt>; in practice, <tt class="docutils literal"><span class="pre">'X'</span></tt> will be the major version number and <tt class="docutils literal"><span class="pre">'Y'</span></tt>
will be the minor version number of the Python release you&#8217;re working with.  For
example, if you are using Python 2.2.1, <tt class="docutils literal"><span class="pre">XY</span></tt> will actually be <tt class="docutils literal"><span class="pre">22</span></tt>.</p>
</div>
<div class="section" id="a-cookbook-approach">
<span id="win-cookbook"></span><h2>4.1. A Cookbook Approach<a class="headerlink" href="#a-cookbook-approach" title="Permalink to this headline">¶</a></h2>
<p>There are two approaches to building extension modules on Windows, just as there
are on Unix: use the <a class="reference internal" href="../library/distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><tt class="xref py py-mod docutils literal"><span class="pre">distutils</span></tt></a> package to control the build process, or
do things manually.  The distutils approach works well for most extensions;
documentation on using <a class="reference internal" href="../library/distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><tt class="xref py py-mod docutils literal"><span class="pre">distutils</span></tt></a> to build and package extension modules
is available in <a class="reference internal" href="../distutils/index.html#distutils-index"><em>Distributing Python Modules</em></a>.  This section describes the manual
approach to building Python extensions written in C or C++.</p>
<p>To build extensions using these instructions, you need to have a copy of the
Python sources of the same version as your installed Python. You will need
Microsoft Visual C++ &#8220;Developer Studio&#8221;; project files are supplied for VC++
version 7.1, but you can use older versions of VC++.  Notice that you should use
the same version of VC++that was used to build Python itself. The example files
described here are distributed with the Python sources in the
<tt class="file docutils literal"><span class="pre">PC\example_nt\</span></tt> directory.</p>
<ol class="arabic">
<li><p class="first"><strong>Copy the example files</strong> &#8212;  The <tt class="file docutils literal"><span class="pre">example_nt</span></tt> directory is a
subdirectory of the <tt class="file docutils literal"><span class="pre">PC</span></tt> directory, in order to keep all the PC-specific
files under the same directory in the source distribution.  However, the
<tt class="file docutils literal"><span class="pre">example_nt</span></tt> directory can&#8217;t actually be used from this location.  You
first need to copy or move it up one level, so that <tt class="file docutils literal"><span class="pre">example_nt</span></tt> is a
sibling of the <tt class="file docutils literal"><span class="pre">PC</span></tt> and <tt class="file docutils literal"><span class="pre">Include</span></tt> directories.  Do all your work
from within this new location.</p>
</li>
<li><p class="first"><strong>Open the project</strong> &#8212;  From VC++, use the <em class="menuselection">File ‣ Open
Solution</em> dialog (not <em class="menuselection">File ‣ Open</em>!).  Navigate to and select
the file <tt class="file docutils literal"><span class="pre">example.sln</span></tt>, in the <em>copy</em> of the <tt class="file docutils literal"><span class="pre">example_nt</span></tt> directory
you made above.  Click Open.</p>
</li>
<li><p class="first"><strong>Build the example DLL</strong> &#8212;  In order to check that everything is set up
right, try building:</p>
</li>
<li><p class="first">Select a configuration.  This step is optional.  Choose
<em class="menuselection">Build ‣ Configuration Manager ‣ Active Solution Configuration</em>
and select either <em class="guilabel">Release</em>  or <em class="guilabel">Debug</em>.  If you skip this
step, VC++ will use the Debug configuration by default.</p>
</li>
<li><p class="first">Build the DLL.  Choose <em class="menuselection">Build ‣ Build Solution</em>.  This
creates all intermediate and result files in a subdirectory called either
<tt class="file docutils literal"><span class="pre">Debug</span></tt> or <tt class="file docutils literal"><span class="pre">Release</span></tt>, depending on which configuration you selected
in the preceding step.</p>
</li>
<li><p class="first"><strong>Testing the debug-mode DLL</strong> &#8212;  Once the Debug build has succeeded, bring
up a DOS box, and change to the <tt class="file docutils literal"><span class="pre">example_nt\Debug</span></tt> directory.  You should
now be able to repeat the following session (<tt class="docutils literal"><span class="pre">C&gt;</span></tt> is the DOS prompt, <tt class="docutils literal"><span class="pre">&gt;&gt;&gt;</span></tt>
is the Python prompt; note that build information and various debug output from
Python may not match this screen dump exactly):</p>
<div class="highlight-c"><pre>C&gt;..\..\PCbuild\python_d
Adding parser accelerators ...
Done.
Python 2.2 (#28, Dec 19 2001, 23:26:37) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import example
[4897 refs]
&gt;&gt;&gt; example.foo()
Hello, world
[4903 refs]
&gt;&gt;&gt;</pre>
</div>
<p>Congratulations!  You&#8217;ve successfully built your first Python extension module.</p>
</li>
<li><p class="first"><strong>Creating your own project</strong> &#8212;  Choose a name and create a directory for
it.  Copy your C sources into it.  Note that the module source file name does
not necessarily have to match the module name, but the name of the
initialization function should match the module name &#8212; you can only import a
module <tt class="xref py py-mod docutils literal"><span class="pre">spam</span></tt> if its initialization function is called <tt class="xref c c-func docutils literal"><span class="pre">initspam()</span></tt>,
and it should call <tt class="xref c c-func docutils literal"><span class="pre">Py_InitModule()</span></tt> with the string <tt class="docutils literal"><span class="pre">&quot;spam&quot;</span></tt> as its
first argument (use the minimal <tt class="file docutils literal"><span class="pre">example.c</span></tt> in this directory as a guide).
By convention, it lives in a file called <tt class="file docutils literal"><span class="pre">spam.c</span></tt> or <tt class="file docutils literal"><span class="pre">spammodule.c</span></tt>.
The output file should be called <tt class="file docutils literal"><span class="pre">spam.pyd</span></tt> (in Release mode) or
<tt class="file docutils literal"><span class="pre">spam_d.pyd</span></tt> (in Debug mode). The extension <tt class="file docutils literal"><span class="pre">.pyd</span></tt> was chosen
to avoid confusion with a system library <tt class="file docutils literal"><span class="pre">spam.dll</span></tt> to which your module
could be a Python interface.</p>
<p>Now your options are:</p>
</li>
<li><p class="first">Copy <tt class="file docutils literal"><span class="pre">example.sln</span></tt> and <tt class="file docutils literal"><span class="pre">example.vcproj</span></tt>, rename them to
<tt class="file docutils literal"><span class="pre">spam.*</span></tt>, and edit them by hand, or</p>
</li>
<li><p class="first">Create a brand new project; instructions are below.</p>
<p>In either case, copy <tt class="file docutils literal"><span class="pre">example_nt\example.def</span></tt> to <tt class="file docutils literal"><span class="pre">spam\spam.def</span></tt>,
and edit the new <tt class="file docutils literal"><span class="pre">spam.def</span></tt> so its second line contains the string
&#8216;<tt class="docutils literal"><span class="pre">initspam</span></tt>&#8216;.  If you created a new project yourself, add the file
<tt class="file docutils literal"><span class="pre">spam.def</span></tt> to the project now.  (This is an annoying little file with only
two lines.  An alternative approach is to forget about the <tt class="file docutils literal"><span class="pre">.def</span></tt> file,
and add the option <em class="xref std std-option">/export:initspam</em> somewhere to the Link settings, by
manually editing the setting in Project Properties dialog).</p>
</li>
<li><p class="first"><strong>Creating a brand new project</strong> &#8212;  Use the <em class="menuselection">File ‣ New
‣ Project</em> dialog to create a new Project Workspace.  Select <em class="guilabel">Visual
C++ Projects/Win32/ Win32 Project</em>, enter the name (<tt class="docutils literal"><span class="pre">spam</span></tt>), and make sure the
Location is set to parent of the <tt class="file docutils literal"><span class="pre">spam</span></tt> directory you have created (which
should be a direct subdirectory of the Python build tree, a sibling of
<tt class="file docutils literal"><span class="pre">Include</span></tt> and <tt class="file docutils literal"><span class="pre">PC</span></tt>).  Select Win32 as the platform (in my version,
this is the only choice).  Make sure the Create new workspace radio button is
selected.  Click OK.</p>
<p>You should now create the file <tt class="file docutils literal"><span class="pre">spam.def</span></tt> as instructed in the previous
section. Add the source files to the project, using <em class="menuselection">Project ‣
Add Existing Item</em>. Set the pattern to <tt class="docutils literal"><span class="pre">*.*</span></tt> and select both <tt class="file docutils literal"><span class="pre">spam.c</span></tt>
and <tt class="file docutils literal"><span class="pre">spam.def</span></tt> and click OK.  (Inserting them one by one is fine too.)</p>
<p>Now open the <em class="menuselection">Project ‣ spam properties</em> dialog. You only need
to change a few settings.  Make sure <em class="guilabel">All Configurations</em> is selected
from the <em class="guilabel">Settings for:</em> dropdown list.  Select the C/C++ tab.  Choose
the General category in the popup menu at the top.  Type the following text in
the entry box labeled <em class="guilabel">Additional Include Directories</em>:</p>
<div class="highlight-c"><pre>..\Include,..\PC</pre>
</div>
<p>Then, choose the General category in the Linker tab, and enter</p>
<div class="highlight-c"><pre>..\PCbuild</pre>
</div>
<p>in the text box labelled <em class="guilabel">Additional library Directories</em>.</p>
<p>Now you need to add some mode-specific settings:</p>
<p>Select <em class="guilabel">Release</em> in the <em class="guilabel">Configuration</em> dropdown list.
Choose the <em class="guilabel">Link</em> tab, choose the <em class="guilabel">Input</em> category, and
append <tt class="docutils literal"><span class="pre">pythonXY.lib</span></tt> to the list in the <em class="guilabel">Additional Dependencies</em>
box.</p>
<p>Select <em class="guilabel">Debug</em> in the <em class="guilabel">Configuration</em> dropdown list, and
append <tt class="docutils literal"><span class="pre">pythonXY_d.lib</span></tt> to the list in the <em class="guilabel">Additional Dependencies</em>
box.  Then click the C/C++ tab, select <em class="guilabel">Code Generation</em>, and select
<em class="guilabel">Multi-threaded Debug DLL</em> from the <em class="guilabel">Runtime library</em>
dropdown list.</p>
<p>Select <em class="guilabel">Release</em> again from the <em class="guilabel">Configuration</em> dropdown
list.  Select <em class="guilabel">Multi-threaded DLL</em> from the <em class="guilabel">Runtime
library</em> dropdown list.</p>
</li>
</ol>
<p>If your module creates a new type, you may have trouble with this line:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">PyVarObject_HEAD_INIT</span><span class="p">(</span><span class="o">&amp;</span><span class="n">PyType_Type</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
<p>Static type object initializers in extension modules may cause
compiles to fail with an error message like &#8220;initializer not a
constant&#8221;.  This shows up when building DLL under MSVC.  Change it to:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">PyVarObject_HEAD_INIT</span><span class="p">(</span><span class="nb">NULL</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
</pre></div>
</div>
<p>and add the following to the module initialization function:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="k">if</span> <span class="p">(</span><span class="n">PyType_Ready</span><span class="p">(</span><span class="o">&amp;</span><span class="n">MyObject_Type</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span>
     <span class="k">return</span> <span class="nb">NULL</span><span class="p">;</span>
</pre></div>
</div>
</div>
<div class="section" id="differences-between-unix-and-windows">
<span id="dynamic-linking"></span><h2>4.2. Differences Between Unix and Windows<a class="headerlink" href="#differences-between-unix-and-windows" title="Permalink to this headline">¶</a></h2>
<p>Unix and Windows use completely different paradigms for run-time loading of
code.  Before you try to build a module that can be dynamically loaded, be aware
of how your system works.</p>
<p>In Unix, a shared object (<tt class="file docutils literal"><span class="pre">.so</span></tt>) file contains code to be used by the
program, and also the names of functions and data that it expects to find in the
program.  When the file is joined to the program, all references to those
functions and data in the file&#8217;s code are changed to point to the actual
locations in the program where the functions and data are placed in memory.
This is basically a link operation.</p>
<p>In Windows, a dynamic-link library (<tt class="file docutils literal"><span class="pre">.dll</span></tt>) file has no dangling
references.  Instead, an access to functions or data goes through a lookup
table.  So the DLL code does not have to be fixed up at runtime to refer to the
program&#8217;s memory; instead, the code already uses the DLL&#8217;s lookup table, and the
lookup table is modified at runtime to point to the functions and data.</p>
<p>In Unix, there is only one type of library file (<tt class="file docutils literal"><span class="pre">.a</span></tt>) which contains code
from several object files (<tt class="file docutils literal"><span class="pre">.o</span></tt>).  During the link step to create a shared
object file (<tt class="file docutils literal"><span class="pre">.so</span></tt>), the linker may find that it doesn&#8217;t know where an
identifier is defined.  The linker will look for it in the object files in the
libraries; if it finds it, it will include all the code from that object file.</p>
<p>In Windows, there are two types of library, a static library and an import
library (both called <tt class="file docutils literal"><span class="pre">.lib</span></tt>).  A static library is like a Unix <tt class="file docutils literal"><span class="pre">.a</span></tt>
file; it contains code to be included as necessary. An import library is
basically used only to reassure the linker that a certain identifier is legal,
and will be present in the program when the DLL is loaded.  So the linker uses
the information from the import library to build the lookup table for using
identifiers that are not included in the DLL.  When an application or a DLL is
linked, an import library may be generated, which will need to be used for all
future DLLs that depend on the symbols in the application or DLL.</p>
<p>Suppose you are building two dynamic-load modules, B and C, which should share
another block of code A.  On Unix, you would <em>not</em> pass <tt class="file docutils literal"><span class="pre">A.a</span></tt> to the
linker for <tt class="file docutils literal"><span class="pre">B.so</span></tt> and <tt class="file docutils literal"><span class="pre">C.so</span></tt>; that would cause it to be included
twice, so that B and C would each have their own copy.  In Windows, building
<tt class="file docutils literal"><span class="pre">A.dll</span></tt> will also build <tt class="file docutils literal"><span class="pre">A.lib</span></tt>.  You <em>do</em> pass <tt class="file docutils literal"><span class="pre">A.lib</span></tt> to the
linker for B and C.  <tt class="file docutils literal"><span class="pre">A.lib</span></tt> does not contain code; it just contains
information which will be used at runtime to access A&#8217;s code.</p>
<p>In Windows, using an import library is sort of like using <tt class="docutils literal"><span class="pre">import</span> <span class="pre">spam</span></tt>; it
gives you access to spam&#8217;s names, but does not create a separate copy.  On Unix,
linking with a library is more like <tt class="docutils literal"><span class="pre">from</span> <span class="pre">spam</span> <span class="pre">import</span> <span class="pre">*</span></tt>; it does create a
separate copy.</p>
</div>
<div class="section" id="using-dlls-in-practice">
<span id="win-dlls"></span><h2>4.3. Using DLLs in Practice<a class="headerlink" href="#using-dlls-in-practice" title="Permalink to this headline">¶</a></h2>
<p>Windows Python is built in Microsoft Visual C++; using other compilers may or
may not work (though Borland seems to).  The rest of this section is MSVC++
specific.</p>
<p>When creating DLLs in Windows, you must pass <tt class="file docutils literal"><span class="pre">pythonXY.lib</span></tt> to the linker.
To build two DLLs, spam and ni (which uses C functions found in spam), you could
use these commands:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="n">cl</span> <span class="o">/</span><span class="n">LD</span> <span class="o">/</span><span class="n">I</span><span class="o">/</span><span class="n">python</span><span class="o">/</span><span class="n">include</span> <span class="n">spam</span><span class="p">.</span><span class="n">c</span> <span class="p">..</span><span class="o">/</span><span class="n">libs</span><span class="o">/</span><span class="n">pythonXY</span><span class="p">.</span><span class="n">lib</span>
<span class="n">cl</span> <span class="o">/</span><span class="n">LD</span> <span class="o">/</span><span class="n">I</span><span class="o">/</span><span class="n">python</span><span class="o">/</span><span class="n">include</span> <span class="n">ni</span><span class="p">.</span><span class="n">c</span> <span class="n">spam</span><span class="p">.</span><span class="n">lib</span> <span class="p">..</span><span class="o">/</span><span class="n">libs</span><span class="o">/</span><span class="n">pythonXY</span><span class="p">.</span><span class="n">lib</span>
</pre></div>
</div>
<p>The first command created three files: <tt class="file docutils literal"><span class="pre">spam.obj</span></tt>, <tt class="file docutils literal"><span class="pre">spam.dll</span></tt> and
<tt class="file docutils literal"><span class="pre">spam.lib</span></tt>.  <tt class="file docutils literal"><span class="pre">Spam.dll</span></tt> does not contain any Python functions (such
as <a class="reference internal" href="../c-api/arg.html#PyArg_ParseTuple" title="PyArg_ParseTuple"><tt class="xref c c-func docutils literal"><span class="pre">PyArg_ParseTuple()</span></tt></a>), but it does know how to find the Python code
thanks to <tt class="file docutils literal"><span class="pre">pythonXY.lib</span></tt>.</p>
<p>The second command created <tt class="file docutils literal"><span class="pre">ni.dll</span></tt> (and <tt class="file docutils literal"><span class="pre">.obj</span></tt> and <tt class="file docutils literal"><span class="pre">.lib</span></tt>),
which knows how to find the necessary functions from spam, and also from the
Python executable.</p>
<p>Not every identifier is exported to the lookup table.  If you want any other
modules (including Python) to be able to see your identifiers, you have to say
<tt class="docutils literal"><span class="pre">_declspec(dllexport)</span></tt>, as in <tt class="docutils literal"><span class="pre">void</span> <span class="pre">_declspec(dllexport)</span> <span class="pre">initspam(void)</span></tt> or
<tt class="docutils literal"><span class="pre">PyObject</span> <span class="pre">_declspec(dllexport)</span> <span class="pre">*NiGetSpamData(void)</span></tt>.</p>
<p>Developer Studio will throw in a lot of import libraries that you do not really
need, adding about 100K to your executable.  To get rid of them, use the Project
Settings dialog, Link tab, to specify <em>ignore default libraries</em>.  Add the
correct <tt class="file docutils literal"><span class="pre">msvcrtxx.lib</span></tt> to the list of libraries.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">4. Building C and C++ Extensions on Windows</a><ul>
<li><a class="reference internal" href="#a-cookbook-approach">4.1. A Cookbook Approach</a></li>
<li><a class="reference internal" href="#differences-between-unix-and-windows">4.2. Differences Between Unix and Windows</a></li>
<li><a class="reference internal" href="#using-dlls-in-practice">4.3. Using DLLs in Practice</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="building.html"
                        title="previous chapter">3. Building C and C++ Extensions with distutils</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="embedding.html"
                        title="next chapter">5. Embedding Python in Another Application</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/extending/windows.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="embedding.html" title="5. Embedding Python in Another Application"
             >next</a> |</li>
        <li class="right" >
          <a href="building.html" title="3. Building C and C++ Extensions with distutils"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v3.2.2 documentation</a> &raquo;</li>

          <li><a href="index.html" >Extending and Embedding the Python Interpreter</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2011, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Sep 04, 2011.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>

  </body>
</html>