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

Structures change type from python readable! #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Well I took a library called libdlo and produced a wrapper. Here is the code I 
ran...

>>> info = dlo_mode_t()
>>> info
<dlo.struct_dlo_mode_s object at 0xb6c4df80>
>>> info = dlo_get_mode(uid)
>>> info
<dlo.LP_struct_dlo_mode_s object at 0xb692d030>

Now the C code is...

dlo_mode_t    *mode_info;
info = dlo_get_mode(uid);

I am on Debian 7.0 Wheezy armhf Raspberry Pi, but this doesn't really have to 
do with my issue.

So it seems that the structures produced by ctypes is not compatible with those 
made by the wrapper!
I tried doing something like 
`LP_struct_dlo_mode_s = struct_dlo_mode_s`
Yet it didn't work, It's really hard to jerry-rig this stuff hahaha

Original issue reported on code.google.com by cool.tes...@gmail.com on 30 Jun 2014 at 8:51

GoogleCodeExporter commented 9 years ago
This is not a bug. In C you create a pointer to the type so the same in python 
would be:

info = ctypes.POINTER(dlo_mode_t)

Original comment by l...@segv.dk on 15 Sep 2014 at 11:45