Hi,
I am trying to expose part of the bullet dynamics library to my python code.
I simply need to expose a few accessors of a type btVector3. This
inherits from a class which is itself derived. I seem to be struggling
to get this right.
Here is my attempt:
BOOST_PYTHON_MODULE(HybridZone)
{
using namespace boost::python;
class_<btQuadWordStorage>("btQuadWordStorage")
;
// I am trying to expose getX()
class_<btQuadWord, bases<btQuadWordStorage> >("btQuadWord")
.def("getX", &btQuadWord::getX, return_internal_reference<1,
with_custodian_and_ward<1, 2> >());
//.add_property("x", &btQuadWord::x) // doesn't compile either
;
class_<btVector3, bases<btQuadWord> >("btVector3", init<float,
float, float>())
;
}
You can see my structure is an attempt to mimic the inheritance diagram
found here
http://www.continuousphysics.com/Bullet/BulletFull/classbtVector3.html
I am trying to expose btVector3::getX(), inherited from btQuadWord
Thanks for your time and advice.
Simon
ps: heres the error message, on gcc4.2.4, Ubuntu 8.04:
...updating 3 targets...
gcc.compile.c++ bin/gcc-4.2.4/debug/HybridZone.o
/home/simon/Source/boost_1_37_0/boost/python/object/make_instance.hpp:
In static member function \u2018static PyObject*
boost::python::objects::make_instance_impl<T, Holder,
Derived>::execute(Arg&) [with Arg = float*, T = float, Holder =
boost::python::objects::pointer_holder<float*, float>, Derived =
boost::python::objects::make_ptr_instance<float,
boost::python::objects::pointer_holder<float*, float> >]\u2019:
/home/simon/Source/boost_1_37_0/boost/python/to_python_indirect.hpp:106:
instantiated from \u2018static PyObject*
boost::python::detail::make_reference_holder::execute(T*) [with T =
float]\u2019
/home/simon/Source/boost_1_37_0/boost/python/to_python_indirect.hpp:70:
instantiated from \u2018PyObject* boost::python::to_python_indirect<T,
MakeHolder>::execute(const U&, mpl_::false_) const [with U = float, T =
const float&, MakeHolder =
boost::python::detail::make_reference_holder]\u2019
/home/simon/Source/boost_1_37_0/boost/python/to_python_indirect.hpp:41:
instantiated from \u2018PyObject* boost::python::to_python_indirect<T,
MakeHolder>::operator()(const U&) const [with U = float, T = const
float&, MakeHolder = boost::python::detail::make_reference_holder]\u2019
/home/simon/Source/boost_1_37_0/boost/python/detail/invoke.hpp:88:
instantiated from \u2018PyObject*
boost::python::detail::invoke(boost::python::detail::invoke_tag_<false,
true>, const RC&, F&, TC&) [with RC =
boost::python::to_python_indirect<const float&,
boost::python::detail::make_reference_holder>, F = const btScalar&
(btQuadWord::*)()const, TC =
boost::python::arg_from_python<btQuadWord&>]\u2019
/home/simon/Source/boost_1_37_0/boost/python/detail/caller.hpp:223:
instantiated from \u2018PyObject*
boost::python::detail::caller_arity<1u>::impl<F, Policies,
Sig>::operator()(PyObject*, PyObject*) [with F = const btScalar&
(btQuadWord::*)()const, Policies =
boost::python::return_internal_reference<1u,
boost::python::with_custodian_and_ward<1u, 2u,
boost::python::default_call_policies> >, Sig = boost::mpl::vector2<const
btScalar&, btQuadWord&>]\u2019
/home/simon/Source/boost_1_37_0/boost/python/object/py_function.hpp:38:
instantiated from \u2018PyObject*
boost::python::objects::caller_py_function_impl<Caller>::operator()(PyObject*,
PyObject*) [with Caller = boost::python::detail::caller<const btScalar&
(btQuadWord::*)()const, boost::python::return_internal_reference<1u,
boost::python::with_custodian_and_ward<1u, 2u,
boost::python::default_call_policies> >, boost::mpl::vector2<const
btScalar&, btQuadWord&> >]\u2019
HybridZone.cpp:88: instantiated from here
/home/simon/Source/boost_1_37_0/boost/python/object/make_instance.hpp:24:
error: invalid application of \u2018sizeof\u2019 to incomplete type
\u2018boost::STATIC_ASSERTION_FAILURE<false>\u2019
"g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -g -fPIC
-DBOOST_DATE_TIME_DYN_LINK=1 -DDATE_TIME_INLINE
-I"/home/simon/Source/boost_1_37_0"
-I"/home/simon/Source/bullet-2.72/src" -I"/usr/local/include/python2.5"
-c -o "bin/gcc-4.2.4/debug/HybridZone.o" "HybridZone.cpp"
...failed gcc.compile.c++ bin/gcc-4.2.4/debug/HybridZone.o...
...skipped <pbin/gcc-4.2.4/debug>HybridZone.so for lack of
<pbin/gcc-4.2.4/debug>HybridZone.o...
...skipped <p.>HybridZone.so for lack of
<pbin/gcc-4.2.4/debug>HybridZone.so...
...failed updating 1 target...
...skipped 2 targets...
--
Linux Counter: User# 424693
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig