python extend c++ module

Discussion in 'Python' started by Shen, Yu-Teh, Jun 30, 2009.

  1. Shen, Yu-Teh

    Shen, Yu-Teh Guest

    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
     
    Shen, Yu-Teh, Jun 30, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    557
  2. §ä´M¦Û¤vªº¤@¤ù¤Ñ

    python extend c++ module

    §ä´M¦Û¤vªº¤@¤ù¤Ñ, Jun 29, 2009, in forum: Python
    Replies:
    0
    Views:
    311
    §ä´M¦Û¤vªº¤@¤ù¤Ñ
    Jun 29, 2009
  3. Shen, Yu-Teh
    Replies:
    3
    Views:
    809
    Philip Semanchuk
    Jul 3, 2009
  4. Patrick Gundlach

    extend(Module) and inheritance

    Patrick Gundlach, Jun 11, 2005, in forum: Ruby
    Replies:
    2
    Views:
    101
    Patrick Gundlach
    Jun 11, 2005
  5. Alexandru Popescu

    include and extend Module - Ruby Way

    Alexandru Popescu, Aug 21, 2005, in forum: Ruby
    Replies:
    9
    Views:
    141
    Devin Mullins
    Aug 22, 2005
Loading...

Share This Page