Boost logo

Boost :

From: Xavier Warin (xavier.warin_at_[hidden])
Date: 2001-04-06 08:31:30


Hi,

I use KCC with BPL and i get error on the following simple program :

namespace python = boost::python;

class Data {
private :
   const double w ;

public :
  Data( double v ) : w(v) {} ;
  ~Data() {}

  double get_val() { return w ; }
  double get_val( double u) { return w*u ; }
} ;

extern "C"
void initriskneut()
{
  try
  {

    // Create an object representing this extension module.
    python::module_builder this_module("alltest");

    // Create the Python type object for our extension class
    boost::python::class_builder< Data > Data_class(this_module, "Data"
);
    Data_class.def(boost::python::constructor< double >());

    // mapping des classes
    Data_class.def( &Data::get_val , "get_val" );
}
  catch(...)
  {
    boost::python::handle_exception(); // Deal with the exception for
Python
  }
}

The message is :

          "boost::python::class_builder<T, U>::def [with T=Data,
          U=boost::python::detail::held_instance<Data>]" matches the
argument
          list
            argument types are: (<unknown-type>, const char [8])
      Data_class.def( &Data::get_val , "get_val" );

The error is due the the fact that the get_val method has two possible
definitions (two fonctions with the same name).
It compiles with GCC. It compiles with KCC if only one definition is
used for get_val.
Do you think that it 's a KCC bug or a BPL one ?
Thank You

Xavier Warin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk