-
-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-architecture: Why does wrapped structure has _pack_ set to True #38
Comments
Seconding this. I have found a similar issue. Furthermore, if I am attempting to create an unpacked structure, it does not set It seems that that clang2py has knowledge of how they are configured in the header file, and ignores it. You get something like: class myStruct(Structure):
_pack_ = True # source:False
_fields_ = ... I can only assume what "source:" refers to is the .h file. |
Short version: It's the result of the cross-architecture ability of ctypeslib. My recollection is that pack and alignment are different attributes returned by clang. Given that ctypeslib is aware of multi-architecture issues, it's a requirement. You cannot ask a python 2.7 ctypes lib on a x86 arch to know how to pack a structure for a arm 128 arch. E.g: the python source file can be used on any other system with possibly a different architecture for the python binary, and still work for the targeted arch. You can read x64 memory bytes from x86, and vice-versa. |
My understanding is that pack expects an integer number, not a boolean expression (according https://docs.python.org/2/library/ctypes.html#structure-union-alignment-and-byte-order ). |
When running the following through clang2py
I get this as ouput
In the ctypes docs is says that pack should be a number (of bytes). When run through the original h2xml/xml2py the pack attribute is set to 2, as expected. Shouldn't this be the behavior of ctypeslib2 as well?
The text was updated successfully, but these errors were encountered: