[Ironpython-users] ctypes module in version 2.7.2 can't create Union values
mva at sysfault.org
mva at sysfault.org
Fri Apr 20 15:45:34 CEST 2012
Dear all,
on a 64-bit Windows 7 machine (other platforms untested), I find
myself unable to create a
ctypes.Union-based class wrapper for a C type.
Regardless of what kind of Union I create, it always ends up with a
"object reference not set to an instance of an object" error from
.NET. Find below a brief
command line example including the necessary .NET and IronPython information.
IronPython 2.7.2.1 (2.7.0.40) on .NET 4.0.30319.261 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> class foo(Union):
... _fields_ = [("t", c_uint), ("b", c_float)]
...
>>> bar = foo()
>>> bar.t = 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
SystemError: Object reference not set to an instance of an object.
I'm not subscribed to this list, in case you require more information
please keep me in CC.
Regards
Marcus
More information about the Ironpython-users
mailing list