Problem with pyplusplus ctypes intergration on AMD64 Machines

10 views
Skip to first unread message

Tim Ansell

unread,
Jan 28, 2009, 8:16:55 PM1/28/09
to python-ogre...@googlegroups.com
Hello,

It appears that the ctypes_intergration stuff in pyplusplus is not 64bit
safe. The general basics is that it is casting a void* to a
boost::uint32_t (which can't fit a void* on 64bit platforms).

See the error below,

/usr/include/OGRE -I/usr/include/python2.5 -I/usr/include/boost
generated/ogre_1.6.1/PatchSurface.pypp.cpp
g++ -o build_dir_2.5/ogre_1.6.1/PixelBox.pypp.os -c `pkg-config
--cflags OGRE` -I -O3 -I./ -DBOOST_PYTHON_MAX_ARITY=19
-DBOOST_PYTHON_NO_PY_SIGNATURES
-I/usr/local/google/foss/pyogre/python-ogre/generated/ogre_1.6.1
-D__PYTHONOGRE_BUILD_CODE -g -I/usr/include -L/usr/lib
-L/usr/lib64 -fPIC -I/usr/include/boost -I/usr/include/OGRE
-I/usr/include/python2.5 -I/usr/include/boost
generated/ogre_1.6.1/PixelBox.pypp.cpp
generated/ogre_1.6.1/__ctypes_integration.pypp.hpp: In function
‘uint32_t pyplusplus::convenience::addressof(const TType*, const
TMemVarType TType::*) [with TType = Ogre::PixelBox, TMemVarType
= void*]’:
generated/ogre_1.6.1/__ctypes_integration.pypp.hpp:49:
instantiated from ‘boost::python::api::object
pyplusplus::convenience::make_addressof_getter(const TMemVarType
TType::*) [with TType = Ogre::PixelBox, TMemVarType = void*]’
generated/ogre_1.6.1/PixelBox.pypp.cpp:162: instantiated from
here
generated/ogre_1.6.1/__ctypes_integration.pypp.hpp:29: error:
cast from ‘void* const*’ to ‘uint32_t’ loses precision
scons: * [build_dir_2.5/ogre_1.6.1/PixelBox.pypp.os] Error 1
scons: building terminated because of errors.

I ended up changing the code in
pyplusplus/code_repository/ctypes_intergration.py from boost::uint32_t
to std::size_t.

It seems to compile and work now...

Is that the correct solution?

Tim 'mithro' Ansell

Roman Yakovenko

unread,
Jan 29, 2009, 12:19:06 AM1/29/09
to python-ogre...@googlegroups.com
On Thu, Jan 29, 2009 at 3:16 AM, Tim Ansell <mit...@gmail.com> wrote:
>
> Hello,
>
> It appears that the ctypes_intergration stuff in pyplusplus is not 64bit
> safe. The general basics is that it is casting a void* to a
> boost::uint32_t (which can't fit a void* on 64bit platforms).

Tim, it seems that you are working with outdated version of Py++.
Thanks to "spom.spom" all 64bit issues should be fixed:

http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py?revision=1471&view=markup
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
Reply all
Reply to author
Forward
0 new messages