Making a python extension in c++

Aaron Drew nospam at nospam.com
Tue Apr 24 09:50:44 EDT 2001


Symbolic symbols for C and C++ differ a great deal. You have to declare your
functions extern "C" in C++ if you want them to be callable from both C and
C++ files.



"Erik Weber" <erikw at lineo.com> wrote in message
news:988067008.220977 at db.lineo.com...
> I am attempting to make a Python-2.0 extension on Linux.  If I include in
> Setup the lines
>
> *shared*
> test test.c
>
> it compiles test.so no problem.  If however I use the lines
>
> *shared*
> test test.cc
>
> then the build fails with;
>
> [erikw at devbrick4 testwiz]$ make
>
fpic  -g -O2 -Wall -Wstrict-prototypes -I/usr/local/include/python2.0 -I/usr
> /loc
> al/include/python2.0 -DHAVE_CONFIG_H -c ./test.cc
> make: fpic: Command not found
> make: [test.o] Error 127 (ignored)
> gcc -shared  test.o  -o test.so
> gcc: test.o: No such file or directory
> gcc: No input files
> make: *** [test.so] Error 1
> [erikw at devbrick4 testwiz]$
>
> It seems to me as though the ".cc" extension causes the Makefile.pre.in
> stuff to fail.  Has anyone compiled a C++ based extension?  If so, what
did
> your Setup file look like?
>
> --
>   -Erik Weber
>    Lineo Seattle
>    206.285.2506 x204
>
>
>
>
>





More information about the Python-list mailing list