den-run-ai / ctypesgen

Automatically exported from code.google.com/p/ctypesgen
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Feature request: support #pragma pack #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
First of all I'd like to say thanks for creating such a useful project. I am 
using it to generate a python ctypes interface for the GSSAPI library on Mac OS 
X and have found one place I need to manually edit the generated code - the 
header for the library contains:

#pragma pack(push,2)
... struct definitions ...
#pragma pack(pop)

and when ctypesgen creates the Structure classes for each struct it omits to 
add a _pack_=2 class attribute, so the alignment of the structs isn't right.
Editing the generated code fixes the problem but it would be great to have 
support for #pragma pack in ctypesgen.

Original issue reported on code.google.com by sigma...@gmail.com on 13 Jan 2013 at 11:20

GoogleCodeExporter commented 9 years ago
PLY, which seems to be what the lex/yacc code in ctypesgen is based on, doesn't 
appear to handle pragma directives.  That means that there doesn't seem to be a 
pragam token, let alone dealing with the token and constructing the right 
attributes for it, so this would likely require a fair amount of effort...

This is also related to issue 46.

Original comment by mike.auty@gmail.com on 4 Jun 2014 at 2:13