472,348 Members | 1,236 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 software developers and data experts.

Re: problem using ctypes with MMX intrinsics

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

Oct 15 '08 #1
2 1863
Robert Kern schrieb:
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.
there is the addressof-function. If this is really the problem, it
should be possible to allocate data + margin (e.g. c_int-arrays), and
cast the proper aligned address via from_address.

Diez
Oct 15 '08 #2
In message <ma**************************************@python.o rg>, Robert
Kern wrote:
Try to check the addresses of the ctypes values you are passing in. I'm
not entirely sure how to do that, though.
Cast the address to an integer and print it out? I think the data needs to
be 16-byte-aligned, so in hex, the units digit of the address should always
be zero.
Oct 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden,...
1
by: sjdevnull | last post by:
Hey, I'm trying to wrap GNU readline with ctypes (the Python readline library doesn't support the callback interface), but I can't figure out...
7
by: p.lavarre | last post by:
How do I vary the byte offset of a field of a ctypes.Structure? How do I "use the dynamic nature of Python, and (re-)define the data type after...
6
by: Jack | last post by:
I'm not able to build IP2Location's Python interface so I'm trying to use ctypes to call its C interface. The functions return a pointer to the...
1
by: moreati | last post by:
Recently I discovered the re module doesn't support POSIX character classes: Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) on linux2 Type...
3
by: Andrew Lentvorski | last post by:
Basically, I'd like to use the ctypes module as a much more descriptive "struct" module. Is there a way to take a ctypes.Structure-based class...
1
by: dcharno | last post by:
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...
0
by: Robert Kern | last post by:
dcharno wrote: Hmm. Okay. Start your program under gdb, find what data it's crashing on, check the alignment on it, and if it's misaligned,...
15
by: Anna Smidt | last post by:
Sorry, I have a question again: I am trying to debug/ release a CLR application (that uses the FrameWork). No when I try to compile it, it stops...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.