[Ctypes-devel] Order matters when using _pack_ attribute
Brought to you by:
theller
From: Tim F. <tf...@co...> - 2005-07-20 02:34:00
|
Hello, The following is a possible bug report. Gccxml 0.7.0 doesn't like the following: #if defined( __GNUC__ ) # define GCC_PACK __attribute__ ((aligned (1),packed)) #endif typedef struct AStruct { // some stuff here } GCC_PACK AStruct; and errors out with: error: syntax error before `__attribute__' even though __attribute__ has been around in GCC for a long time. I tested out adding _pack_ = 1 to the generated python code but found out that it doesn't work unless it is added _before_ fields is defined. My expectation was that it was order independent. OK, since I have lots and lots of these structs, I was determined to add a command line option for global packing to xml2py, which I did. Let me know if you'd like it. I commented out all of the assertions for size and offset as I am using another method to verify everything. Please reply via email as I haven't subscribed. Regards, Tim |