S
Shen, Yu-Teh
I have written a c++ extend module and I use distutils to build.
setup.py
----------------
from distutils.core import setup, Extension
setup(name="noddy", version="1.0",
ext_modules=[
Extension("noddy3", ["noddy3.cpp", "a.cpp"])
])
I found it's quite strange when compiling. I didn't use extern "C" at
all
, how can python get the right c++ funciton name without any compile
error??
I found that it first use gcc to compile noddy3.cpp and then link by g+
+.
Could anyone explain what it's all about?
Thanks a lot!!
here is the compiling message.
---------------------------------------
running install
running build
running build_ext
building 'noddy3' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -fPIC -I/usr/local/include/python2.6 -c noddy3.cpp
-o
build/temp.linux-i686-2.6/noddy3.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid
for
Ada/C/ObjC but not for C++
g++ -pthread -shared build/temp.linux-i686-2.6/noddy3.o
build/temp.linux-i686-2.6/a.o -o build/lib.linux-i686-2.6/noddy3.so
build/temp.linux-i686-2.6/a.o -o build/lib.linux-i686-2.6/noddy3.so
running install_lib
copying build/lib.linux-i686-2.6/noddy3.so ->
/usr/local/lib/python2.6/site-packages
running install_egg_info
Removing /usr/local/lib/python2.6/site-packages/noddy-1.0-py2.6.egg-
info
Writing /usr/local/lib/python2.6/site-packages/noddy-1.0-py2.6.egg-info
setup.py
----------------
from distutils.core import setup, Extension
setup(name="noddy", version="1.0",
ext_modules=[
Extension("noddy3", ["noddy3.cpp", "a.cpp"])
])
I found it's quite strange when compiling. I didn't use extern "C" at
all
, how can python get the right c++ funciton name without any compile
error??
I found that it first use gcc to compile noddy3.cpp and then link by g+
+.
Could anyone explain what it's all about?
Thanks a lot!!
here is the compiling message.
---------------------------------------
running install
running build
running build_ext
building 'noddy3' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -fPIC -I/usr/local/include/python2.6 -c noddy3.cpp
-o
build/temp.linux-i686-2.6/noddy3.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid
for
Ada/C/ObjC but not for C++
g++ -pthread -shared build/temp.linux-i686-2.6/noddy3.o
build/temp.linux-i686-2.6/a.o -o build/lib.linux-i686-2.6/noddy3.so
build/temp.linux-i686-2.6/a.o -o build/lib.linux-i686-2.6/noddy3.so
running install_lib
copying build/lib.linux-i686-2.6/noddy3.so ->
/usr/local/lib/python2.6/site-packages
running install_egg_info
Removing /usr/local/lib/python2.6/site-packages/noddy-1.0-py2.6.egg-
info
Writing /usr/local/lib/python2.6/site-packages/noddy-1.0-py2.6.egg-info