~ubuntu-branches/ubuntu/natty/pysvn/natty

« back to all changes in this revision

Viewing changes to Import/pycxx-5.4.2/README.html

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-02-23 20:08:08 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223200808-t946skprxzf6vjqx
Tags: 1.6.3-0ubuntu1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<html>
2
 
 
3
 
<head>
4
 
<title>PyCXX README</title>
5
 
 
6
 
<style>
7
 
H1, H2, H3, H4 {color: #000099;
8
 
        background-color: lightskyblue}
9
 
h3 {position: relative; left: 20px}
10
 
 
11
 
p {position: relative; left: 20px; margin-right: 20px}
12
 
pre {color: #0000cc; background-color: #eeeeee; position: relative; left: 40px; margin-right: 80px;
13
 
        border-style: solid; border-color: black; border-width: thin}
14
 
kbd {color: #990000}
15
 
p cite, ol cite, ul cite {font-family: monospace; font-style: normal; font-size: normal}
16
 
li var, pre var, p var, kbd var {color: #009900; font-style: italic}
17
 
li samp, pre samp, p samp, kbd samp {color: #009900; font-weight: bold}
18
 
li p {position: relative; left: 0}
19
 
table { position: relative; left: 20px; border: solid #888888 1px; background-color: #eeeeee}
20
 
table th {border: solid #888888 1px; background-color: #88dd88; color: black}
21
 
table td {border: solid #888888 1px}
22
 
table td.code {border: solid #888888 1px;font-family: monospace; font-style: normal; font-size: normal}
23
 
p.param {background-color: #eeeeee; border-top: lightskyblue solid 4}
24
 
</style>
25
 
</head>
26
 
 
27
 
<body>
28
 
 
29
 
<h1>PyCXX -- Python C++ Extensions Support</h1>
30
 
 
31
 
<h2>Installation using distutils</h2>
32
 
 
33
 
<h3>Windows Installation and Demo</h3>
34
 
<ol>
35
 
<li>Fetch <a href="http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz">
36
 
http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz</a></li>
37
 
<li>Expand the archive into a directory of your choosing C:\ for example.
38
 
Note: WinZip can expand .tar.gz files.</li>
39
 
<li>Install the PyCXX files:
40
 
<ol>
41
 
<li><pre>C:> cd \pycxx-5.4.2</pre></li>
42
 
<li><pre>C:\pycxx-5.4.2> python setup.py install</pre></li>
43
 
</ol>
44
 
</li>
45
 
<li>Install the PyCXX Demo:
46
 
<ol>
47
 
<li><pre>C:> cd \pycxx-5.4.2\Demo</pre></li>
48
 
<li><pre>C:\pycxx-5.4.2\Demo> python setup.py install</pre></li>
49
 
</ol>
50
 
</li>
51
 
<li>Run the demo:
52
 
<ol>
53
 
<li><pre>C:> python</pre></li>
54
 
<li><pre>&gt;&gt;&gt; import CXX.example</pre></li>
55
 
<li><pre>&gt;&gt;&gt; CXX.example.test()</pre></li>
56
 
<li><pre>&gt;&gt;&gt; r = CXX.example.range( 11, 100, 13 )</pre></li>
57
 
<li><pre>&gt;&gt;&gt; for i in r: print i</pre></li>
58
 
<li><pre>...</pre></li>
59
 
</ol>
60
 
</li>
61
 
</ul>
62
 
</li>
63
 
</ol>
64
 
 
65
 
 
66
 
<h3>Unix Installation and Demo</h3>
67
 
<p>Note: distutils is not available for Python 1.5.2</p>
68
 
 
69
 
<ol>
70
 
<li>Fetch <a href="http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz">
71
 
http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz</a>
72
 
<li>Login as root. root access is typically needed on Unix systems to install the PyCXX files into the Python directories.
73
 
<li>Expand the archive into a directory of your choosing ~\ for example.
74
 
<li>Install the PyCXX files:
75
 
<ol>
76
 
<li><pre># cd ~\pycxx-5.4.2</pre>
77
 
<li><pre># python setup.py install</pre>
78
 
</ol>
79
 
<li>Install the PyCXX Demo:
80
 
<ol>
81
 
<li><pre># cd ~\pycxx-5.4.2\Demo</pre>
82
 
<li><pre># python setup.py install</pre>
83
 
</ol>
84
 
<li>Run the demos:
85
 
<ol>
86
 
<li><pre>$ python</pre>
87
 
<li><pre>&gt;&gt;&gt; import CXX.example</pre>
88
 
<li><pre>&gt;&gt;&gt; CXX.example.test()</pre>
89
 
<li><pre>&gt;&gt;&gt; r = CXX.example.range( 11, 100, 13 )</pre>
90
 
<li><pre>&gt;&gt;&gt; for i in r: print i</pre>
91
 
<li><pre>...</pre>
92
 
</ol>
93
 
</ul>
94
 
</ol>
95
 
 
96
 
<h2>Installation using Project and Makefile</h2>
97
 
 
98
 
<p>If you cannot or do not wish to use the distutils methods to work with PyCXX a set
99
 
of Makefiles and Project files are provided.</p>
100
 
 
101
 
<h3>Windows Installation and Demo</h3>
102
 
<p>
103
 
<ol>
104
 
<li>Fetch <a href="http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz">
105
 
http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz</a>
106
 
<li>Expand the archive into a directory of your choosing C:\ for example. WinZip can expand .tar.gz files.
107
 
<li>Build the example. Using Microsoft .NET 2003 C++ for python version 2.4 or later load the workspace corresponsing to the version of
108
 
Python you wish the work with.
109
 
<ul>
110
 
<li>example_py24.sln - Python 2.4 and its maintanence release
111
 
<li>example_py25.sln - Python 2.5 and its maintanence release
112
 
</ul>
113
 
<li>Build the example. Using Microsoft Visual C++ 6.0 for python versions upto 2.3 load the solution corresponsing to the version of
114
 
Python you wish the work with.
115
 
<ul>
116
 
<li>example_py15.dsw - Python 1.5.2
117
 
<li>example_py20.dsw - Python 2.0 and 2.0.1
118
 
<li>example_py21.dsw - Python 2.1 and 2.1.1
119
 
<li>example_py22.dsw - Python 2.2 and its maintanence release
120
 
<li>example_py23.dsw - Python 2.3 and its maintanence release
121
 
</ul>
122
 
<li>Run the example. (I'll assume you are testing Python 2.3)
123
 
<ul>
124
 
<li>cd c:\pycxx-5.4.2\pyds23
125
 
<li>c:\python21\python -c "import example;example.test()"
126
 
</ul>
127
 
</ol>
128
 
</p>
129
 
<h3>Unix and Mac OS X Installation and Demo</h3>
130
 
<p>
131
 
<ol>
132
 
<li>Fetch <a href="http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz">
133
 
http://prdownloads.sourceforge.net/cxx/pycxx-5.4.2.tar.gz</a>
134
 
<li>Expand the archive into a directory of your choosing ~/ for example.
135
 
<li>Select to makefile for your system and python version.
136
 
<ul>
137
 
<li>example_freebsd_py15.mak - FreeBSD Python 1.5.2 (see <a href="#note_1_5_2">note</a> below)
138
 
<li>example_freebsd_py20.mak - FreeBSD Python 2.0, 2.0.1
139
 
<li>example_freebsd_py21.mak - FreeBSD Python 2.1, 2.1.1
140
 
<li>example_freebsd_py22.mak - FreeBSD Python 2.2
141
 
<li>example_freebsd_py23.mak - FreeBSD Python 2.3
142
 
<li>example_linux_py15.mak - Linux Python 1.5.2
143
 
<li>example_linux_py20.mak - Linux Python 2.0, 2.0.1
144
 
<li>example_linux_py21.mak - Linux Python 2.1, 2.1.1
145
 
<li>example_linux_py22.mak - Linux Python 2.2
146
 
<li>example_linux_py23.mak - Linux Python 2.3
147
 
<li>example_linux_py24.mak - Linux Python 2.4
148
 
<li>example_linux_py25.mak - Linux Python 2.5
149
 
<li>example_linux_py26.mak - Linux Python 2.6
150
 
<li>example_fink_10.3_py24.mak - Mac OS X 10.3 fink Python 2.4
151
 
<li>example_fink_10.4_py24.mak - Mac OS X 10.4 fink Python 2.4
152
 
<li>example_mac_py23.mak - Mac OS X Apple Python 2.3
153
 
<li>example_mac_py24.mak - Mac OS X Python 2.4
154
 
<li>example_mac_py25.mak - Mac OS X Python 2.5
155
 
<li>example_mac_py26.mak - Mac OS X Python 2.6
156
 
</ul>
157
 
<li>Build the example. Use GNU make<br>
158
 
$ make -f <var>example-makefile</var> example.so
159
 
<li>Run the examples.<br>
160
 
$ make -f <var>example-makefile</var> test
161
 
</ol>
162
 
</p>
163
 
 
164
 
<p><a id="note_1_5_2">Note:</a> The Unix version of python 1.5.2 may need to be rebuilt so that C++ is support.
165
 
If you get reports of undefined symbols like cout or cerr then its likely that python
166
 
is not compiled and linked to support C and C++.</p>
167
 
 
168
 
<p>To create a makefile for another vendors Unix follow these steps:</p>
169
 
<ol>
170
 
<li>copy one of the example make files above.
171
 
<li>edit the variables to match your Python installation and C++ compile needs
172
 
<li>Proceed to build and test as above.
173
 
</ol>
174
 
<p>Note: most of the makefile rules to build PyCXX and its example are contained in example_common.mak.
175
 
</p>
176
 
 
177
 
<h2>Revision History</h2>
178
 
 
179
 
<h3>Version 5.4.2 (11-Oct-2008)</h3>
180
 
<p>Add support for rich compare.</p>
181
 
<p>Add the simplest code for a module with a single function and a single class (Demo/simple.cxx)</p>
182
 
<p>Fix long standing bugs with Dict::iterator</p>
183
 
 
184
 
<h3>Version 5.4.1 (28-Jun-2008)</h2>
185
 
<p>Add Boolean type from Vivian De Smedt.</p>
186
 
<p>Patch from Dmitry Kostjuchenko to which improves PyCXX's method calling
187
 
speed/performance by almost 2 times.</p>
188
 
<p>More PY_LONG_LONG support.</p>
189
 
<p>No longer allow creation of Py::Int from PY_LONG_LONG as long long cannot fit. Use Py::Long.</p>
190
 
<p>Py:Dict can now be constructed from a Py::Object.</p>
191
 
 
192
 
<h3>Version 5.4.0 (20-Jan-2007)</h3>
193
 
<p>PyCXX has a new <a href="https://svn.sourceforge.net/svnroot/cxx/trunk/CXX/COPYRIGHT">BSD license</a>
194
 
to make it open source compatible.
195
 
Many thanks to Sebastian Sauer for bring this matter to our attention and 
196
 
to Paul Dubios for working with the LLNL people to get the license changed.</p>
197
 
<p>Fix compilation issues with GCC 4.1 found on FC6.</p>
198
 
<p>Fix compilation issues caused by problems in IRIX header files.</p>
199
 
<p>Add PY_LONG_LONG support from patch contributed by Dmitry Kostjuchenko.</p>
200
 
 
201
 
<h3>Version 5.3.6 (15-Oct-2006)</h3>
202
 
<p>Support for Python 2.5 - Fix issues around new typedef Py_ssize_t</p>
203
 
 
204
 
<h3>Version 5.3.5 (2-Oct-2005)</h3>
205
 
<p>More changes to keep GCC 4.0 happy - no warning should be report</p>
206
 
 
207
 
<h3>Version 5.3.4 (29-Aug-2005)</h3>
208
 
<p>Add interator support - thanks to Helmut Jarausch - see pycxx_iter demo</p>
209
 
<p>Allow an extension to be part of a python package</p>
210
 
<p>Allow creation of Exception hierachies</p>
211
 
<p>Fix problem compiling with GCC 2.9X</p>
212
 
<p>Fix uninitialise memory problem</p>
213
 
<P>Work around compile problems with the example and GCC 4.0.</p>
214
 
 
215
 
<h3>Version 5.3.3 and 5.3.2</h3>
216
 
<p>No details recorded</p>
217
 
 
218
 
<h3>Version 5.3.1 (19-Jan-2005)</h3>
219
 
<p>Support GCC4 and Microsoft .NET 2003 aka MSVC 7.1</p>
220
 
 
221
 
<h3>Version 5.3 (21-Oct-2004)</h3>
222
 
<p>String object now support python string and unicode string objects.</p>
223
 
<p>Fix most bugs reported on SourceForge</p>
224
 
 
225
 
<h3>Version 5.2 (27-Nov-2003)</h3>
226
 
<p>PyCXX supports Python version 2.3, 2.2, 2.1, 2.0 and 1.5.2 on Windows and Unix.</p>
227
 
<p>Fixed problems with keyword functions.</p>
228
 
<p>Improve Extension API to give access to names and docs</p>
229
 
<p>Support GCC 3.</p>
230
 
<p>Added support for custom Exceptions</p>
231
 
 
232
 
<h3>Version 5.1 (2-Aug-2001)</h3>
233
 
<p>I'm using the name PyCXX for this package, CXX is far to close to a compilers name.</p>
234
 
 
235
 
<p>PyCXX supports Python version 2.2, 2.1.1, 2.1, 2.0, 2.0.1 and 1.5.2 on Windows and Unix.</p>
236
 
 
237
 
<p>New in this release:</p>
238
 
<ul>
239
 
<li>Support for the Windows Linker /DELAYLOAD feature. Enable this feature by
240
 
defining PY_WIN32_DELAYLOAD_PYTHON_DLL when compiling IndirectPythonInterface.cxx</li>
241
 
<li>Remove "CXX/Array.hxx" and associated code - its does not belong in PyCXX</li>
242
 
<li>Work on the docs. Mostly to clean up the HTML to allow more extensive work.</li>
243
 
<li>Reformated the sources to a consistent style. The mix of styles and tabs sizes
244
 
was making working on the sources error prone.</li>
245
 
<li>Added workaround to setup.py to allow GCC to compile c++ code.</li>
246
 
<li>Added Microsoft Visual C++ 6.0 project files for 1.5, 2.0 and 2.1 builds</li>
247
 
<li>Added Unix make files for Linux (tested on RedHat 7.1) and FreeBSD (tested on 4.3)</li>
248
 
<li>Merged changes from Tom Malcolmson</li>
249
 
</ul>
250
 
 
251
 
<h3>(July 9, 2000)</h3>
252
 
<p>Renamed all header files to reflect the CXX include name space and that they are
253
 
C++ header files.</p>
254
 
<table cellspacing=0 cellpadding=3px>
255
 
<tr><th>Old</th><th>New</th></tr>
256
 
<tr><td>#include "CXX_Config.h"</td><td>#include "CXX/Config.hxx"</td></tr>
257
 
<tr><td>#include "CXX_Exception.h"</td><td>#include "CXX/Exception.hxx"</td></tr>
258
 
<tr><td>#include "CXX_Extensions.h"</td><td>#include "CXX/Extensions.hxx"</td></tr>
259
 
<tr><td>#include "CXX_Objects.h"</td><td>#include "CXX/Objects.hxx"</td></tr>
260
 
</table>
261
 
 
262
 
<h3>Version 5 (May 18, 2000)</h3>
263
 
<p>This version adds Distutils support for installation and some code cleanup.</p>
264
 
 
265
 
<h3>Version 4 (October 11, 1999)</h3>
266
 
 
267
 
<p>This version contains a massive revision to the part of CXX that supports creating
268
 
extension objects and extension modules. Barry Scott contributed these changes.</p>
269
 
 
270
 
<p>CXX has always consisted of two parts: the basic CXX_Objects.h and the more
271
 
experimental CXX_Extensions.h. We will describe the changes to CXX_Objects first, and then
272
 
the changes to CXX_Extensions.h.</p>
273
 
 
274
 
<h3>Changes to CXX_Objects</h3>
275
 
 
276
 
<h4>1. Owned option eliminates need for FromAPI in most cases</h4>
277
 
 
278
 
<p>Object's constructor from PyObject* and method set have a new (backward compatible)
279
 
signature:</p>
280
 
 
281
 
<pre>
282
 
Object (PyObject* pyob, bool owned = false);
283
 
void set(PyObject* pyob, bool owned = false);
284
 
</pre>
285
 
 
286
 
<p>Users may call these with owned = true if they own the reference pyob already and want
287
 
the Object instance to take over ownership.</p>
288
 
 
289
 
<p>A new inline function Object asObject(PyObject* pyob) returns Object(pyob, true); thus,
290
 
one way to construct an object from a pointer returned by the Python API is to call
291
 
asObject on it. </p>
292
 
 
293
 
<p>Previously a class FromAPI was provided to solve the problem of taking over an owned
294
 
reference. FromAPI will be eliminated in the next release. It is no longer used by CXX
295
 
itself or its demos. The new mechanism is much cleaner and more efficient.</p>
296
 
 
297
 
<p>Other classes in CXX have been given the same &quot;owned&quot; option on their
298
 
constructors: Int, Float, Long, Complex, SeqBase&lt;T&gt;, Tuple, List, Dict, Module,
299
 
Callable.</p>
300
 
 
301
 
<h4>2. Namespace support in compiler assumed</h4>
302
 
 
303
 
<p>Since EGCS / GCC now supports namespaces and the standard library, the need for
304
 
CXX_config.h is almost gone. We have eliminated all the macros except for one obscure one
305
 
dealing with iterator traits in the standard library.</p>
306
 
 
307
 
<h3>Changes to CXX_Extensions</h3>
308
 
 
309
 
<p>The changes to CXX_Extensions.h are not backward compatible. However, they simplify
310
 
coding so much that we think it is worth the disruption.</p>
311
 
 
312
 
<h4>1. Creating an extension module</h4>
313
 
 
314
 
<p>To create an extension module, you inherit from class ExtensionModule templated on
315
 
yourself: In the constructor, you make calls to register methods of this class with Python
316
 
as extension module methods. In this example, two methods are added (this is a simplified
317
 
form of the example in Demo/example.cxx):</p>
318
 
 
319
 
<pre>class example_module : public ExtensionModule&lt;example_module&gt;
320
 
{
321
 
public:
322
 
    example_module()
323
 
        : ExtensionModule&lt;example_module&gt;( &quot;example&quot; )
324
 
        {
325
 
        add_varargs_method(&quot;sum&quot;, &amp;example_module::ex_sum, &quot;sum(arglist) = sum of arguments&quot;);
326
 
        add_varargs_method(&quot;test&quot;, &amp;example_module::ex_test, &quot;test(arglist) runs a test suite&quot;);
327
 
 
328
 
        initialize( &quot;documentation for the example module&quot; );
329
 
        }
330
 
 
331
 
    virtual ~example_module() {}
332
 
 
333
 
private:
334
 
    Object ex_sum (const Tuple &amp;a) { ... }
335
 
    Object ex_test( const Tuple &amp;a) { ... }
336
 
};
337
 
</pre>
338
 
 
339
 
<p>To initialize the extension, you just instantiate one static instance (static so it
340
 
doesn't destroy itself!):</p>
341
 
 
342
 
<pre>
343
 
void initexample()
344
 
    {
345
 
    static example_module* example = new example_module;
346
 
    }
347
 
</pre>
348
 
 
349
 
<p>The methods can be written to take Tuples as arguments and return Objects. If
350
 
exceptions occur they are trapped for you and a Python exception is generated. So, for
351
 
example, the implementation of ex_sum might be:</p>
352
 
 
353
 
<pre>
354
 
Object ex_sum (const Tuple &amp;a)
355
 
    {
356
 
        Float f(0.0);
357
 
        for( int i = 0; i &lt; a.length(); i++ )
358
 
        { 
359
 
            Float g(a[i]);
360
 
            f = f + g;
361
 
        }
362
 
        return f;
363
 
    }
364
 
</pre>
365
 
 
366
 
<p>class ExtensionModule contains methods to return itself as a Module object, or to
367
 
return its dictionary.</p>
368
 
 
369
 
<h4>Creating extension objects</h4>
370
 
 
371
 
<p>Creating extension objects is of course harder since you must specify how the object
372
 
behaves and give it methods. This is shown in some detail in the example range.h and range.cxx,
373
 
with the test routine rangetest.cxx, in directory Demo.</p>
374
 
 
375
 
<p>Here is a brief overview. You create a class that inherits from PythonExtension
376
 
templated upon itself. You override various methods from PythonExtension to implement
377
 
behaviors, such as getattr, sequence_item, etc. You can also add methods to the object
378
 
that are usable from Python using a similar scheme as for module methods above. </p>
379
 
 
380
 
<p>One of the consequences of inheriting from PythonExtension is that you are inheriting
381
 
from PyObject itself. So your class is-a PyObject and instances of it can be passed to the
382
 
Python C API. Note: this example uses the namespace feature of CXX. The Py:: 's are not
383
 
required if you use the namespace instead.</p>
384
 
 
385
 
<pre>
386
 
class range: public Py::PythonExtension&lt;range&gt; {
387
 
public:
388
 
    ... constructors, etc.
389
 
 
390
 
    ... methods
391
 
    // initializer, see below
392
 
    static void init_type();
393
 
    // override functions from PythonExtension
394
 
    virtual Py::Object repr();
395
 
    virtual Py::Object getattr( const char *name );
396
 
 
397
 
    virtual int sequence_length();
398
 
    virtual Py::Object sequence_item( int i );
399
 
    virtual Py::Object sequence_concat( const Py::Object &amp;j );
400
 
    virtual Py::Object sequence_slice( int i, int j );
401
 
 
402
 
    // define python methods of this object
403
 
    Py::Object amethod (const Py::Tuple&amp; args);
404
 
    Py::Object value (const Py::Tuple&amp; args);
405
 
    Py::Object assign (const Py::Tuple&amp; args); 
406
 
};
407
 
</pre>
408
 
 
409
 
<p>
410
 
To initialize the type you provide a static method that you can call from some module's
411
 
initializer. This method sets the name, doc string, and indicates which behaviors it
412
 
supports. It then adds the methods.</p>
413
 
 
414
 
<pre>
415
 
void range::init_type()
416
 
{
417
 
    behaviors().name(&quot;range&quot;);
418
 
    behaviors().doc(&quot;range objects: start, stop, step&quot;);
419
 
    behaviors().supportRepr();
420
 
    behaviors().supportGetattr();
421
 
    behaviors().supportSequenceType();
422
 
 
423
 
    add_varargs_method(&quot;amethod&quot;, &amp;range::amethod,
424
 
        &quot;demonstrate how to document amethod&quot;);
425
 
    add_varargs_method(&quot;assign&quot;, &amp;range::assign);
426
 
    add_varargs_method(&quot;value&quot;, &amp;range::value);
427
 
}
428
 
</pre>
429
 
 
430
 
<h3>Version 3 (June 18, 1999)</h3>
431
 
 
432
 
<p>1. CXX compiles with EGCS snapshot 19990616. EGCS requires a standard library class
433
 
random_access_iterator that is not yet available in some other compilers (such as Windows
434
 
VC6). Therefore a new switch:</p>
435
 
 
436
 
<p>STANDARD_LIBRARY_HAS_ITERATOR_TRAITS</p>
437
 
 
438
 
<p>has been added to CXX_Config.h that you may need to toggle if you get an error on the
439
 
two lines that mention random_access_iterator. The current definition is correct for VC6
440
 
and EGCS-19990616. </p>
441
 
 
442
 
<p>2. A new constructor was added to Module to allow construction from a string containing
443
 
the module name. A test was added for this to the demo.</p>
444
 
 
445
 
<h3>Version 2 (Dec. 28, 1998)</h3>
446
 
 
447
 
<p>Fixed definition of extension type to match 1.5.2. This version will presumably not
448
 
compile with older versions of Python. This can be fixed by using the previous version's
449
 
definition. I did not take the time to find out what these new &quot;flags&quot; are for
450
 
nor put in any methods to deal with them.</p>
451
 
 
452
 
<h3>Version 1</h3>
453
 
 
454
 
<p>This is an experimental set of files for supporting the creation of Python extensions
455
 
in C++. </p>
456
 
 
457
 
<p>Documentation is in progress at <a href="http://xfiles.llnl.gov">http://xfiles.llnl.gov</a>.
458
 
</p>
459
 
 
460
 
<p>To use CXX you use the header files in Include, such as CXX_Objects.h or
461
 
CXX_Extensions.h. You must include the sources in Src in your sources to supply parts of
462
 
the CXX classes required.</p>
463
 
 
464
 
<p>A demo is included. The Setup file in this directory compiles this demo named
465
 
&quot;example&quot;. To try the demo, which is also a test routine, you import example and
466
 
then execute:</p>
467
 
 
468
 
<pre>
469
 
example.test()
470
 
</pre>
471
 
 
472
 
<p>You can also play with the extension object whose constructor is named &quot;range&quot;:</p>
473
 
 
474
 
<pre>
475
 
s = range(1, 100, 2)
476
 
print s[2]  # should print 5
477
 
</pre>
478
 
 
479
 
<p>Compilation with Microsoft Visual C++ 5.0 will succeed but only if you have Service
480
 
Pack 3 installed. Compilation has been known to succeed on a Unix system using KCC by
481
 
using:</p>
482
 
 
483
 
<pre>
484
 
setenv CCC &quot;KCC -x&quot;
485
 
</pre>
486
 
 
487
 
<p>before running makethis.py.</p>
488
 
 
489
 
<p>There is also a python.cxx file for making a stand-alone Python containing this
490
 
example, as well as a similar file arraytest.cxx for testing Array.</p>
491
 
 
492
 
<p>Comments to barry@barrys-emacs.org, please.</p>
493
 
 
494
 
<p>Barry Scott</p>
495
 
</body>
496
 
</html>