-
Attached patch fixed code generator:
1. Incomplete structures were defined twice, one with an empty _fields_ which cause ctypes raise "is final" error.
2. Variables in dll could be defined before its structure's _fields_ is defined. This cause 'is final' too.
3. c_longdouble is python2.6+ feature.
2009-09-15 16:32:31 UTC by mozbugbox
-
Since ctypes is now distributed as part of Python, such a request must go into the Python tracker at bugs.python.org.
However, the 'callable as restype' protocol is broken because it only works when the foreing function returns an integer; it will not work for functions returning pointers when sizeof(int) != sizeof(void *)'. A new protocol must be developed for this to work in full...
2009-03-26 20:55:05 UTC by theller
-
Hi,
Adding support for classes to be sent as an argument using the argtypes attribute and from_param(...) method seems pretty straight forward. Can a similar extension be done to support the restype attribute, or will the errcheck attribute be needed to do this conversion on the result?
More specifically I'd like to convert from ctypes arrays to NumPy arrays on the fly when calling a DLL...
2009-03-26 15:14:05 UTC by ztyx
-
theller added the gccxml-0.9.0-win32-x86.exe file.
2008-12-19 07:45:39 UTC by theller
-
theller created the 2008-08-12 file release.
2008-12-19 07:39:13 UTC by theller
-
I am using ctype to insert both ascii and unicode data to win32 ListView Control , using the following structure
class LV_ITEM(Structure):
_fields_ = [('mask', c_uint),
('iItem', c_int),
('iSubItem', c_int),
('state', c_uint),
('stateMask', c_uint),
# ('pszText', c_char_p), # for ascii data
('pszText', c_wchar_p), # for unicode data...
2008-11-10 01:10:43 UTC by lys2008
-
The code generator doesn't handle any #defined constants with doubles. The patch contains a fix for the generator as well as coverage for the unit tests.
The patch is applied against the ctypeslib-gccxml-0.9 branch, but might similarly work also against trunk.
2008-10-18 22:32:21 UTC by guyster
-
Ok, I can reproduce the behaviour on windows. Thanks for the clear report, I will look into it.
First comment: I am not sure this is a bug or not, I will investigate what the C compiler does.
One difference between your structure A and B is that the size is different, also the alignment of the second field is different.
The problem also goes away when you replace the 'c_int' in structure...
2008-05-21 17:48:56 UTC by theller
-
c_char, c_byte, c_short, c_ubyte, and c_ushort are the causes. Everything else is working fine.
The problem is only when the object is initialized. When that happens the bit fields after the data type are cleared to zeros but can then be used normally without problems. Bit fields before the data type are not effected. If a working data type is between a not working data type and the...
2008-05-20 01:55:03 UTC by hexdecimal
-
I also found that c_byte is causing the same problem.
2008-05-19 20:11:28 UTC by hexdecimal