991010}
1111
12- \date {14 Jul 1994 \\ Release 1.0.3} % XXX update before release!
12+ \date {14 July 1994 \\ Release 1.0.3} % XXX update before release!
1313
1414% Tell \index to actually write the .idx file
1515\makeindex
2323\begin {abstract }
2424
2525\noindent
26- This document describes how to write modules in C or C++ to extend the
26+ This document describes how to write modules in C or \Cpp {} to extend the
2727Python interpreter. It also describes how to use Python as an
2828`embedded' language, and how extension modules can be loaded
2929dynamically (at run time) into the interpreter, if the operating
4343\pagenumbering {arabic}
4444
4545
46- \chapter {Extending Python with C or C++ code }
46+ \chapter {Extending Python with C or \Cpp {} code }
4747
4848
4949\section {Introduction }
@@ -57,12 +57,9 @@ \section{Introduction}
5757
5858Extension modules can do two things that can't be done directly in
5959Python: they can implement new data types (which are different from
60- classes by the way), and they can make system calls or call C library
61- functions. Since the latter is usually the most important reason for
62- adding an extension, I'll concentrate on adding `wrappers' around C
63- library functions; the concrete example uses the wrapper for
64- \code {system()} in module \code {posix}, found in (of course) the file
65- \file {Modules/posixmodule.c}.
60+ classes, by the way), and they can make system calls or call C library
61+ functions. We'll see how both types of extension are implemented by
62+ examining the code for a Python curses interface.
6663
6764Note: unless otherwise mentioned, all file references in this
6865document are relative to the toplevel directory of the Python
@@ -112,7 +109,7 @@ \section{A first look at the code}
112109are passed to the C function. The C function always has two
113110parameters, conventionally named \var {self} and \var {args}. The
114111\var {self} argument is used when the C function implements a builtin
115- method --- this is advanced material and not covered in this document .
112+ method---this will be discussed later .
116113In the example, \var {self} will always be a \code {NULL} pointer, since
117114we are defining a function, not a method (this is done so that the
118115interpreter doesn't have to understand two different types of C
@@ -780,9 +777,9 @@ \section{Reference counts}
780777\code {DECREF()} on your object. You should use \code {DEL()} instead.
781778
782779
783- \section {Writing extensions in C++ }
780+ \section {Writing extensions in \Cpp {} }
784781
785- It is possible to write extension modules in C++ . Some restrictions
782+ It is possible to write extension modules in \Cpp {} . Some restrictions
786783apply: since the main program (the Python interpreter) is compiled and
787784linked by the C compiler, global or static objects with constructors
788785cannot be used. All functions that will be called directly or
@@ -797,7 +794,7 @@ \chapter{Embedding Python in another application}
797794
798795Embedding Python is similar to extending it, but not quite. The
799796difference is that when you extend Python, the main program of the
800- application is still the Python interpreter, while of you embed
797+ application is still the Python interpreter, while if you embed
801798Python, the main program may have nothing to do with Python ---
802799instead, some parts of the application occasionally call the Python
803800interpreter to run some Python code.
@@ -820,13 +817,13 @@ \chapter{Embedding Python in another application}
820817\file {Demo/embed}.
821818
822819
823- \section {Embedding Python in C++ }
820+ \section {Embedding Python in \Cpp {} }
824821
825- It is also possible to embed Python in a C++ program; how this is done
826- exactly will depend on the details of the C++ system used; in general
827- you will need to write the main program in C++ , and use the C++
828- compiler to compile and link your program. There is no need to
829- recompile Python itself with C++ .
822+ It is also possible to embed Python in a \Cpp {} program; precisely how this
823+ is done will depend on the details of the \Cpp {} system used; in general you
824+ will need to write the main program in \Cpp {} , and use the \Cpp {} compiler
825+ to compile and link your program. There is no need to recompile Python
826+ itself using \Cpp {} .
830827
831828
832829\chapter {Dynamic Loading }
@@ -860,7 +857,7 @@ \section{Configuring and building the interpreter for dynamic loading}
860857
861858\subsection {Shared libraries }
862859
863- The following systems supports dynamic loading using shared libraries:
860+ The following systems support dynamic loading using shared libraries:
864861SunOS 4; Solaris 2; SGI IRIX 5 (but not SGI IRIX 4!); and probably all
865862systems derived from SVR4, or at least those SVR4 derivatives that
866863support shared libraries (are there any that don't?).
0 commit comments