Passing structures as parameters to functions
2006-04-01 21:00:15 GMT
Hi!
I am currently using ctypes to write a Python wrapper for a Windows-dll
which is written in C. So far it has worked quite well, but at the
moment I have got some problems: I have to pass a structure as a
parameter to a function, but whenever I try this I get the following
error: "ctypes.ArgumentError: argument 1: exceptions.TypeError: Don't
know how to convert parameter 1"
The structure looks like this:
class NvConfiguration(Structure):
_fields_ = [('bindingType', c_int),
('appStorageClass', c_int),
('serviceType', c_byte),
('updateType', c_int),
('offlineType', c_int),
('setPriorityConfigurable', c_int),
('authConfigurable', c_int)]
The function which is called:
def OpenNetInterface(self, netIntfConfig, nodeSelfDoc, iniFilePath):
# What kind of "argtype" is NvConfiguration then? Structure
doesn't work.
# self._xlonhapi.OpenNetInterface.argtypes = [Structure,
c_char_p, c_char_p]
return self._xlonhapi.OpenNetInterface(netIntfConfig,
nodeSelfDoc, iniFilePath)
(Continue reading)
RSS Feed