problem using ctypes with MMX intrinsics

Robert Kern robert.kern at
Wed Oct 15 20:55:45 CEST 2008

dcharno wrote:
> Is it possible to use ctypes with a shared library which uses MMX/SSE 
> intrinsics?  I can load the library and access functions inside it, but 
> I getting a seg fault when I hit one of the intrinsics.  I'm wondering 
> if there might be some sort of stack alignment problem.
> I am using gcc version 4.2.3 and Python 2.5.2 on Ubuntu 8.04.
> Any suggestions would be helpful.

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 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.

Robert Kern

"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 mailing list