Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Reply-To: From: "Peter Bienstman" To: "Jason Tishler" , Subject: RE: building Python extension modules - crash on import Date: Mon, 6 Aug 2001 11:36:08 +0200 Message-ID: <000001c11e5b$38aaa810$0454c19d@intec.rug.ac.be> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0001_01C11E6B.FC34FEB0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0 Importance: Normal In-Reply-To: <20010805220448.B496@dothill.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 ------=_NextPart_000_0001_01C11E6B.FC34FEB0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > If you can refer me to a self contained (i.e. not dependent on other > libraries, etc.) Python C++ extension, then I'm willing to fiddle around > with it. Attached are a simple C++ file convert.cpp and a makefile. The Python extension does however require the Boost Python Library (www.boost.org), a C++ system to create Python extension modules. The linking fails with errors like: convert.o(.complex boost::python::detail::text$complex_from_python(_object *, boost::python::type)+0x10):convert.cpp: undefined reference to `PyInt_Type' ../ /users/pbienst/tmp/boost_cvs/libs/python/src/libboost_python.a(extension_cla ss.o)(.text+0x3ad):extension_class.cpp: undefined reference to `PyExc_RuntimeError' ... These are symbols which I suppose must be in libpython2.1. Thanks, Peter ------------------------------------- Peter Bienstman Department of Information Technology INTEC/IMEC - Ghent University St.-Pietersnieuwstraat 41 B-9000 Gent - Belgium E-mail: Peter DOT Bienstman AT rug DOT ac DOT be Tel: +32 9 264 3445 Fax: +32 9 264 3593 ------------------------------------- ------=_NextPart_000_0001_01C11E6B.FC34FEB0 Content-Type: application/octet-stream; name="convert.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="convert.cpp" #include =0A= #include "boost/python/class_builder.hpp"=0A= =0A= using namespace boost::python;=0A= =0A= struct Expression { Expression() {} };=0A= =0A= struct Term =0A= {=0A= Term() {}=0A= Term(const Expression&) {}=0A= };=0A= =0A= void f(const Term& t) {}=0A= =0A= struct A { A(const Term&) {} };=0A= =0A= BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE=0A= =0A= PyObject* to_python(const Expression& e)=0A= {=0A= return to_python(Term(e));=0A= }=0A= =0A= BOOST_PYTHON_END_CONVERSION_NAMESPACE=0A= =0A= BOOST_PYTHON_MODULE_INIT(convert)=0A= {=0A= try=0A= {=0A= =0A= module_builder convert("convert");=0A= =0A= class_builder Term_(convert, "Term");=0A= Term_.def(constructor<>());=0A= Term_.def(constructor());=0A= =0A= class_builder Expression_(convert, "Expression");=0A= Expression_.def(constructor<>());=0A= =0A= convert.def(f , "f");=0A= =0A= class_builder A_(convert, "A");=0A= A_.def(constructor());=0A= }=0A= catch(...)=0A= {=0A= } =0A= }=0A= =0A= =0A= =0A= =0A= ------=_NextPart_000_0001_01C11E6B.FC34FEB0 Content-Type: application/octet-stream; name="makefile" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="makefile" # location of the Python header files=0A= =0A= PYTHON =3D /usr/include/python2.1=0A= =0A= # location of the Boost Python include files and library=0A= =0A= BOOST_INC =3D /users/pbienst/tmp/boost_cvs=0A= BOOST_LIB =3D /users/pbienst/tmp/boost_cvs/libs/python/src=0A= =0A= convert.dll: convert.o=0A= g++ -shared -Wl,--enable-auto-image-base,--export-dynamic \=0A= convert.o -L$(BOOST_LIB) -lboost_python \=0A= -L/usr/lib/python2.1/config -lpython2.1 \=0A= -o convert.dll=0A= =0A= convert.o: convert.cpp=0A= g++ -I$(PYTHON) -I$(BOOST_INC) -c convert.cpp =0A= =0A= clean:=0A= rm -f *.o *.dll *.a *~ core=0A= ------=_NextPart_000_0001_01C11E6B.FC34FEB0 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------=_NextPart_000_0001_01C11E6B.FC34FEB0--