Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2000-12-09 21:08:09


There are new versions of ivect.cpp and dvect.cpp at:

    http://cci.lbl.gov/~rwgk/cvs/cvsweb.cgi/bpl_tru64/

The exported function pointers are now wrapped in a struct.
This is exactly the mechanism used by Jim Fulton's ExtensionClass.
Is this portable?
  
For reasons that escape me I have to declare the to_python wrapper
functions as extern "C", e.g.:
    
extern "C" PyObject *ivect_to_python(const vects::ivect& iv)
{
  return BOOST_PYTHON_CONVERSION::to_python(iv);
}
    
Alternatively, if ivect_to_python is declared without the extern "C",
I had to use a cast, e.g.:
    
    static ivect_converters_t ivect_converters = {
      PyObject *(*)(const vects::ivect& iv) ivect_to_python,
    };

Why doesn't this work without the extern "C" and without the cast?
Is there a way to avoid ivect_to_python altogether? E.g., is the
following somehow possible?

    static ivect_converters_t ivect_converters = {
      (some_cast) BOOST_PYTHON_CONVERSION::to_python,
    };

Thanks!
        Ralf


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