weird "bytes missing" error for a callback definition
Patricio Stegmann <[email protected]>
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
Hello to all,
I am doing a little wrapper for a library that performs some live image acquisition.
This library has a callback mechanism which is called when there is an available live image.
The headers are quite simple:
# ------------------------
DLLIMPORT SetImageCallBack(void (*ptr_ImageCallback)(int, int, char * ) );
This got translated to:
# ------------------------
STRING = c_char_p
SetImageCallBack = _stdcall_libraries['mylib.dll'].SetImageCallBack
SetImageCallBack.restype = c_int
SetImageCallBack.argtypes = [CFUNCTYPE(None, c_int, c_int, STRING)]
However I am getting this error:
# ------------------------
ValueError: Procedure probably called with not enough arguments (4 bytes missing)
This is the simplified code that makes this error happen:
# ------------------------
# initialize the callbacks dictionnary
callbacks = {}
# define python function to be called by the callback
def ViewFinderCallback(int_1, int_2, charp_1):
print 'viewfindercallback'
return 0 # return None does the same thing
# declaration
SetImageCallBack = _stdcall_libraries['mylib.dll'].SetImageCallBack
SetImageCallBack.restype = c_int
CallbackFunctionImageCallback = CFUNCTYPE(None, c_int, c_int, STRING)
SetImageCallBack.argtypes = [CallbackFunctionImageCallback]
callbacks['ViewFinderCallback'] = CallbackFunctionImageCallback(self.ViewFinderCallback)
# then registry of the callback
SetImageCallBack(callbacks['ViewFinderCallback'])
This gives me the error ... I dont know what is wrong here.
I hope someone can help me please,
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
ctypes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ctypes-users