Hello,

I am trying to wrap a simple class that runs some image processing routines.
I would like them to be script-able from python.

I am not trying to pass complicated types, in fact almost all the functions
take and return no arguments. Here is my wrapper code (generated with
pyplusplus partially):


#include "boost/python.hpp"

#include "eventDetector.h"

namespace bp = boost::python;

BOOST_PYTHON_MODULE(pyplusplus){

    { //::eventDetector
        typedef bp::class_< eventDetector > eventDetector_exposer_t;
        eventDetector_exposer_t eventDetector_exposer =
eventDetector_exposer_t( "eventDetector", bp::init< params & >((
bp::arg("op") )) );
        bp::scope eventDetector_scope( eventDetector_exposer );
        bp::implicitly_convertible< params &, eventDetector >();
        { //::eventDetector::detect

            typedef void ( ::eventDetector::*detect_function_type )(  ) ;

            eventDetector_exposer.def(
                "detect"
                , detect_function_type( &::eventDetector::detect ) );

        }
        { //::eventDetector::init

            typedef void ( ::eventDetector::*init_function_type )(  ) ;

            eventDetector_exposer.def(
                "init"
                , init_function_type( &::eventDetector::init ) );

        }
        { //::eventDetector::load

            typedef void ( ::eventDetector::*load_function_type )(  ) ;

            eventDetector_exposer.def(
                "load"
                , load_function_type( &::eventDetector::load ) );

        }
        { //::eventDetector::save

            typedef void ( ::eventDetector::*save_function_type )(  ) ;

            eventDetector_exposer.def(
                "save"
                , save_function_type( &::eventDetector::save ) );

        }
        { //::eventDetector::setGridSize

            typedef void ( ::eventDetector::*setGridSize_function_type )(
int,int ) ;

            eventDetector_exposer.def(
                "setGridSize"
                , setGridSize_function_type( &::eventDetector::setGridSize )
                , ( bp::arg("x"), bp::arg("y") ) );

        }
        { //::eventDetector::setVideoCapture

            typedef bool ( ::eventDetector::*setVideoCapture_function_type
)( ::std::string ) ;

            eventDetector_exposer.def(
                "setVideoCapture"
                , setVideoCapture_function_type(
&::eventDetector::setVideoCapture )
                , ( bp::arg("filename") ) );

        }
        { //::eventDetector::setVideoCapture

            typedef bool ( ::eventDetector::*setVideoCapture_function_type
)( int ) ;

            eventDetector_exposer.def(
                "setVideoCapture"
                , setVideoCapture_function_type(
&::eventDetector::setVideoCapture )
                , ( bp::arg("cam") ) );

        }
        { //::eventDetector::train

            typedef void ( ::eventDetector::*train_function_type )(  ) ;

            eventDetector_exposer.def(
                "train"
                , train_function_type( &::eventDetector::train ) );

        }
    }

    bp::class_< params >( "params" )
        ... large list of simple params...;

}


It builds fine using bjam but when I import into python I get an error
message: libEventDetector.so: undefined symbol: _ZN13eventDetector4loadEv.

I am really not very good with boost::python and I don't really know what to
do. Help is appreciated, thank you!
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to