[C++-sig] Help with problem caused going from boost_1_33_1 to 1_35_0

Tony Kirke pyspuc at gmail.com
Tue Jun 10 05:05:47 CEST 2008


Sorry, couldn't attach file. It is available here:

http://pyspuc.com/testcase.tar.gz

On Mon, Jun 9, 2008 at 6:58 PM, Tony Kirke <pyspuc at gmail.com> wrote:

> Thanks Ralf,
> I tried reversing the order to no avail. I'm attached a gzipped tar file of
> the example, if anyone would like to try it. I'd be grateful to confirm if
> there is an issue or not. Only things that may need to be edited would be
> path to boost_1_35_0 and python 2.4/2.5
> Tony
>
> 2008/6/9 Ralf W. Grosse-Kunstleve <rwgk at yahoo.com>:
>
>> I stared at your code for a few minutes but I don't have an answer
>> for you. It looks like it should work. I'm not aware of changes in
>> Boost.Python that could make your code fail.
>> I'd probably try to reverse the import order:
>>
>> from spucb.iir_coeff import *
>> from spucb.butterworth_iir import *
>>
>> although I don't expect this to make a difference.
>>
>> Ralf
>>
>>
>> ----- Original Message ----
>> From: Tony Kirke <pyspuc at gmail.com>
>> To: c++-sig at python.org <c%2B%2B-sig at python.org>
>> Sent: Monday, June 9, 2008 8:25:20 AM
>> Subject: [C++-sig] Help with problem caused going from boost_1_33_1 to
>> 1_35_0
>>
>> Hi,
>> My c++ code that worked fine for Boost_1_33_1 (building with v1 system) is
>> now giving the following error with 1_35_0:
>>
>> Boost.Python.ArgumentError: Python argument types in
>>     spucb.butterworth_iir.butterworth_iir(iir_coeff, float)
>> did not match C++ signature:
>>     butterworth_iir(iir_coeff {lvalue}, float)
>>
>> I done a lot of searching to find out what changed in the newer
>> Boost/boost build system and could not figure out what to do.
>> Below is all of the code for a simple testcase. Since I have lots of code
>> that is broken in this way,  I'm wondering if there is an easy change that
>> can be made to the boost wrapping code (or source itself) to make this
>> functional.  Is there a simple example of how this problem is solved. Was
>> there a fundamental reason this is no longer supported?
>> Thanks
>>
>> Tony
>>
>> ------------------------------------------
>> class iir_coeff
>> {
>> public:
>>   long order;
>>
>> public:
>>   iir_coeff(long ord=1);
>>   ~iir_coeff();
>> };
>> ------------------------------------------
>> #include "iir_coeff.h"
>> iir_coeff::iir_coeff(long ord) {
>>   order = ord;
>> }
>> iir_coeff::~iir_coeff() {}
>> ------------------------------------------
>> // Boost Includes
>> ==============================================================
>> #include <boost/python.hpp>
>> #include <boost/cstdint.hpp>
>>
>> // Includes
>> ====================================================================
>> #include "iir_coeff.h"
>>
>> // Using
>> =======================================================================
>> using namespace boost::python;
>>
>> // Module
>> ======================================================================
>> BOOST_PYTHON_MODULE(iir_coeff)
>> {
>>   class_< iir_coeff >("iir_coeff", init< const iir_coeff& >())
>>         .def(init< optional< long int > >())
>>     .def_readwrite("order", &iir_coeff::order)
>>     ;
>>
>> }
>> ------------------------------------------
>> #include "iir_coeff.h"
>> void butterworth_iir(iir_coeff& filt, float fcd);
>> ------------------------------------------
>> #include "butterworth_iir.h"
>> void butterworth_iir(iir_coeff& filt, float fcd) {
>>   long order = filt.order;
>>   filt.order = order+1;
>> }
>> ------------------------------------------
>> // Boost Includes
>> ==============================================================
>> #include <boost/python.hpp>
>> #include <boost/cstdint.hpp>
>>
>> // Includes
>> ====================================================================
>> #include "butterworth_iir.h"
>>
>> // Using
>> =======================================================================
>> using namespace boost::python;
>>
>> // Module
>> ======================================================================
>> BOOST_PYTHON_MODULE(butterworth_iir)
>> {
>>   def("butterworth_iir", &butterworth_iir);
>> }
>>
>> ------------------------------------------
>> use-project boost   : ../../boost_1_35_0 ;
>>
>> project
>>   : requirements <library>/boost/python//boost_python/<link>static
>>   : usage-requirements  <include>../../boost_1_35_0 <include>.
>>     ;
>>
>> lib spuc :
>> butterworth_iir.cpp
>> iir_coeff.cpp
>> :
>>  <include>.
>>  <include>../../boost_1_35_0
>>
>> ;
>>
>> alias staticspuc : spuc/<link>static ;
>>
>> import python ;
>>
>>
>> python-extension butterworth_iir :   py_butterworth_iir.cpp : <include>.
>> <include>../../boost_1_35_0 :  <library>staticspuc ;
>> python-extension iir_coeff :   py_iir_coeff.cpp :  <include>.
>> <include>../../boost_1_35_0 :  <library>staticspuc ;
>>
>> install dist :
>> __init__.py
>> butterworth_iir
>> iir_coeff
>> :
>>         <location>/usr/lib/python2.4/site-packages/spucb
>> ;
>>
>> ------------------------------------------
>> boost-build ../../boost_1_35_0/tools/build/v2 ;
>> ------------------------------------------
>>
>> from spucb.butterworth_iir import *
>> from spucb.iir_coeff import *
>> x=iir_coeff(8)
>> butterworth_iir(x,0.24)
>> print x.order
>>
>> ------------------------------------------
>> Traceback (most recent call last):
>>   File "tes.py", line 4, in ?
>>     butterworth_iir(x,0.24)
>> Boost.Python.ArgumentError: Python argument types in
>>     spucb.butterworth_iir.butterworth_iir(iir_coeff, float)
>> did not match C++ signature:
>>     butterworth_iir(iir_coeff {lvalue}, float)
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> C++-sig mailing list
>> C++-sig at python.org <C%2B%2B-sig at python.org>
>> http://mail.python.org/mailman/listinfo/c++-sig
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080609/b392f3c2/attachment.htm>


More information about the Cplusplus-sig mailing list