Array fields are not handled
Bug #570683 reported by
vldmrrr
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PyBindGen |
Confirmed
|
Low
|
Unassigned |
Bug Description
Attached is proposed patch to handle array fields in structures. Also adds few missing type aliases
Changed in pybindgen: | |
status: | New → Confirmed |
importance: | Undecided → Low |
To post a comment you must log in.
Hi. Sorry for not merging this yet. I had look at the patch a long time ago, found something wrong, wanted to fix it myself, but then I ran out of time.
IIRC, one thing I found wrong is:
class UnsignedIntPtrP aram(PointerPar ameter) :
DIRECTIONS = [Parameter. DIRECTION_ IN, Parameter. DIRECTION_ OUT, Parameter. DIRECTION_ INOUT]
- CTYPES = ['unsigned int*', 'uint32_t*']
+ CTYPES = ['uint32_t*', 'unsigned int*', 'unsigned long*', 'long unsigned*', 'long unsigned int*', 'unsigned long int*']
The problem is that "unsigned long" is a 64-bit integer on LP64 platforms (64-bit linux, for instance), and 32-bit one in ILP32 (32-bit system) or LLP64 (64-bit Windows). So we really can't mix "long int" and "int".
I think there was something wrong in the gccxmlparser.py part, but I don't remember exactly what it was. I hope to eventually find time to review this patch. If you're in a hurry to get this in, one thing that can help is the inclusion of unit tests to exercise this new array field functionality.