Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit afcd589

Browse files
committed
Retract the statement that all functions called by Python (even method
defs) need to be declared extern "C" -- it seems to have no basis in truth (any more?).
1 parent 03710d2 commit afcd589

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

Doc/ext.tex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,10 +1227,9 @@ \section{Writing Extensions in \Cpp{}}
12271227
apply. If the main program (the Python interpreter) is compiled and
12281228
linked by the \C{} compiler, global or static objects with constructors
12291229
cannot be used. This is not a problem if the main program is linked
1230-
by the \Cpp{} compiler. All functions that will be called directly or
1231-
indirectly (i.e. via function pointers) by the Python interpreter will
1232-
have to be declared using \code{extern "C"}; this applies to all
1233-
``methods'' as well as to the module's initialization function.
1230+
by the \Cpp{} compiler. Functions that will be called by the
1231+
Python interpreter (in particular, module initalization functions)
1232+
have to be declared using \code{extern "C"}.
12341233
It is unnecessary to enclose the Python header files in
12351234
\code{extern "C" \{...\}} --- they use this form already if the symbol
12361235
\samp{__cplusplus} is defined (all recent \Cpp{} compilers define this

Doc/ext/ext.tex

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,10 +1227,9 @@ \section{Writing Extensions in \Cpp{}}
12271227
apply. If the main program (the Python interpreter) is compiled and
12281228
linked by the \C{} compiler, global or static objects with constructors
12291229
cannot be used. This is not a problem if the main program is linked
1230-
by the \Cpp{} compiler. All functions that will be called directly or
1231-
indirectly (i.e. via function pointers) by the Python interpreter will
1232-
have to be declared using \code{extern "C"}; this applies to all
1233-
``methods'' as well as to the module's initialization function.
1230+
by the \Cpp{} compiler. Functions that will be called by the
1231+
Python interpreter (in particular, module initalization functions)
1232+
have to be declared using \code{extern "C"}.
12341233
It is unnecessary to enclose the Python header files in
12351234
\code{extern "C" \{...\}} --- they use this form already if the symbol
12361235
\samp{__cplusplus} is defined (all recent \Cpp{} compilers define this

0 commit comments

Comments
 (0)