problem using ctypes with MMX intrinsics
robert.kern at gmail.com
Thu Oct 16 01:23:39 CEST 2008
> Robert Kern wrote:
>> Well, stack alignment would be a problem with how the shared library
>> gets compiled, nothing to do with ctypes (I think). However, if you are
> The shared library is built with '-m32 -msse2' and works fine from a
> C/C++ test harness, so I think its compiled okay.
> > passing in arrays from ctypes, *they* may also be misaligned. Try to
> > check the addresses of the ctypes values you are passing in. I'm not
> > entirely sure how to do that, though.
> I'm only passing filenames and some string options through the API. All
> the data that gets processed with MMX/SSE is opened inside the shared
Hmm. Okay. Start your program under gdb, find what data it's crashing on, check
the alignment on it, and if it's misaligned, figure out where that data is
Is the ctypes driver doing the same exact operations as the C++ test harness? If
not, it may be exposing a bug in your code. I've had a few occasions when using
SSE2 intrinsics where I had a bug in my loop such that I was going off the end
of the array due to a thinko.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list