Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / ext / cplusplus.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="using-cobjects.html" />
12<link rel="prev" href="refcounts.html" />
13<link rel="parent" href="intro.html" />
14<link rel="next" href="using-cobjects.html" />
15<meta name='aesop' content='information' />
16<title>1.11 Writing Extensions in C++
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.10.4 NULL Pointers"
25 href="nullPointers.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.12 Providing a C"
31 href="using-cobjects.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="nullPointers.html">1.10.4 NULL Pointers</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="using-cobjects.html">1.12 Providing a C</A>
49</div>
50<hr /></div>
51</DIV>
52<!--End of Navigation Panel-->
53
54<H1><A NAME="SECTION0031100000000000000000"></A><A NAME="cplusplus"></A>
55<BR>
561.11 Writing Extensions in C++
57
58</H1>
59
60<P>
61It is possible to write extension modules in C++. Some restrictions
62apply. If the main program (the Python interpreter) is compiled and
63linked by the C compiler, global or static objects with constructors
64cannot be used. This is not a problem if the main program is linked
65by the C++ compiler. Functions that will be called by the
66Python interpreter (in particular, module initialization functions)
67have to be declared using <code>extern "C"</code>.
68It is unnecessary to enclose the Python header files in
69<code>extern "C" {...}</code> -- they use this form already if the symbol
70"<tt class="samp">__cplusplus</tt>" is defined (all recent C++ compilers define this
71symbol).
72
73<P>
74
75<DIV CLASS="navigation">
76<div class='online-navigation'>
77<p></p><hr />
78<table align="center" width="100%" cellpadding="0" cellspacing="2">
79<tr>
80<td class='online-navigation'><a rel="prev" title="1.10.4 NULL Pointers"
81 href="nullPointers.html"><img src='../icons/previous.png'
82 border='0' height='32' alt='Previous Page' width='32' /></A></td>
83<td class='online-navigation'><a rel="parent" title="1. Extending Python with"
84 href="intro.html"><img src='../icons/up.png'
85 border='0' height='32' alt='Up One Level' width='32' /></A></td>
86<td class='online-navigation'><a rel="next" title="1.12 Providing a C"
87 href="using-cobjects.html"><img src='../icons/next.png'
88 border='0' height='32' alt='Next Page' width='32' /></A></td>
89<td align="center" width="100%">Extending and Embedding the Python Interpreter</td>
90<td class='online-navigation'><a rel="contents" title="Table of Contents"
91 href="contents.html"><img src='../icons/contents.png'
92 border='0' height='32' alt='Contents' width='32' /></A></td>
93<td class='online-navigation'><img src='../icons/blank.png'
94 border='0' height='32' alt='' width='32' /></td>
95<td class='online-navigation'><img src='../icons/blank.png'
96 border='0' height='32' alt='' width='32' /></td>
97</tr></table>
98<div class='online-navigation'>
99<b class="navlabel">Previous:</b>
100<a class="sectref" rel="prev" href="nullPointers.html">1.10.4 NULL Pointers</A>
101<b class="navlabel">Up:</b>
102<a class="sectref" rel="parent" href="intro.html">1. Extending Python with</A>
103<b class="navlabel">Next:</b>
104<a class="sectref" rel="next" href="using-cobjects.html">1.12 Providing a C</A>
105</div>
106</div>
107<hr />
108<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
109</DIV>
110<!--End of Navigation Panel-->
111<ADDRESS>
112See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
113</ADDRESS>
114</BODY>
115</HTML>