Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python extend c++ module

Reply
Thread Tools

python extend c++ module

 
 
Shen, Yu-Teh
Guest
Posts: n/a
 
      06-30-2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
dealloc function in python extend c module Shen, Yu-Teh Python 3 07-03-2009 03:17 AM
python extend c++ module 找尋自己的一片天 Python 0 06-29-2009 11:13 AM
how to debug python's extend module written in c/c++ on windows tcfg@sina.com Python 6 07-17-2008 03:02 PM
extend(Module) and inheritance Patrick Gundlach Ruby 2 06-11-2005 04:05 PM
Using python to extend a python app dataangel Python 1 03-24-2005 10:48 PM



Advertisments