boost python vs. 2.0 (boost
1_29_0):
msvc++ 6.0
compile problems
---------------------------------------------------------
i am having a problem compiling any statement containing a
call policy.
in particular in the reference manual there is the
following example:
#include <boost/python/module.hpp>
#include
<boost/python/class.hpp>
#include
<boost/python/reference_existing_object.hpp>
#include
<boost/python/return_value_policy.hpp>
#include
<utility>
// classes to wrap
struct
Singleton
{
Singleton() : x(0) {}
int
exchange(int n) // set x and return the old value
{
std::swap(n,
x);
return n;
}
int x;
};
Singleton&
get_it()
{
static Singleton just_one;
return
just_one;
}
// Wrapper code
using namespace
boost::python;
BOOST_PYTHON_MODULE(singleton)
{
def("get_it", get_it,
reference_existing_object());
class_<Singleton>("Singleton")
.def("exchange",
&Singleton::exchange)
;
}
The line
def("get_it", get_it,
reference_existing_object());
results in the following compiler errors (comment
it out and everything compiles)
c:\projects\components\boost\boost\python\detail\returning.hpp(102) :
error C2039: 'result_converter' : is not a member of
'reference_existing_object'
c:\projects\components\boost\boost\python\reference_existing_object.hpp(28) :
see declaration of
'reference_existing_object'
c:\projects\components\boost\boost\python\detail\caller.hpp(71) : see reference
to function template instantiation 'struct _object *__cdecl
boost::python::detail::returning<struct Singleton &>::call(struct
Singleton &(__cdecl *)(void),struct
_object *,struct _object
*,const struct boost::python::reference_existing_object *)' being
compiled
c:\projects\components\boost\boost\python\detail\returning.hpp(102)
: error C2146: syntax error : missing ';' before identifier
'result_converter'
c:\projects\components\boost\boost\python\detail\caller.hpp(71) : see reference
to function template instantiation 'struct _object *__cdecl
boost::python::detail::returning<struct Singleton &>::call(struct
Singleton &(__cdecl *)(void),struct
_object *,struct _object
*,const struct boost::python::reference_existing_object *)' being
compiled
c:\projects\components\boost\boost\python\detail\returning.hpp(102)
: warning C4091: '' : ignored on left of 'int' when no variable is
declared
c:\projects\components\boost\boost\python\detail\caller.hpp(71) : see reference
to function template instantiation 'struct _object *__cdecl
boost::python::detail::returning<struct Singleton &>::call(struct
Singleton &(__cdecl *)(void),struct
_object *,struct _object
*,const struct boost::python::reference_existing_object *)' being
compiled
and a bunch more.
I cannot use jam to build my
extensions so i am just using visual studio (i have done this successfully in
the pass with pre 2.0 versions).
I assume i am missing a #define
or something dumb. if there is an faq or something i
should be looking at just direct me there.
thanks in
advance
alan
scales