[ctypes-users] Re: help: Procedure called with not enough arguments (16 bytes missing) or wrong cal
Brought to you by:
theller
From: Thomas H. <th...@py...> - 2005-03-31 19:02:46
|
Guillaume Proux <gui...@sc...> writes: > Hi, > >>>>> pg = cdll.LoadLibrary("c:\PrintPRO3.dll") >>>>> pg >>>> >> <CDLL 'c:\PrintPRO3.dll', handle 1800000 at 12f7e90> >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> ValueError: Procedure called with not enough arguments (16 bytes >> missing) or wrong calling convention > > Probably the right answer is "wrong calling convention" > try > pg = windll.LoadLibrary("c:\PrintPRO3.dll") I wonder if ctypes should change its behaviour here. First, when this error occurrs, the functions has successfully been called. If ctypes would emit a warning instead of raising an error, one could even get the return value. Second, ctypes *is* able to restore the stack after the call, even when the wrong calling convention had been used - it can already detect this. So, maybe even the warning should be supressed? That was how the old calldll did it, IIRC. The 'problem' would be that the differences between cdll/CDLL and windll/WinDLL would vanish. And the above is only true for calling functions in libraries - implementing callback functions with WINFUNCTYPE and CFUNCTYPE would have to use the correct calling convention (but maybe this is expert stuff anyway ;). Opinions? Thomas |