ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values
duncan.booth at invalid.invalid
Thu Jan 29 14:44:45 CET 2009
alex <alecla at bluewin.ch> wrote:
> Thank you for your answer. I tried it with no success.
> However I tried with
> tst=cdll.LoadLibrary("f:\\scratch\\test2\\footst.dll") instead of
> and it runs now with no error message, I can't figure for now why, but
> it's great! This is motivating for going ahead.
cdll is for importing functions which use the cdecl calling convention
where the caller must clean up the stack.
windll is for functions that use the stdcall calling convention: the
function that is called is responsible for cleaning up the stack.
If you were using windll when you should have been using cdll then ctypes
will have been expecting the library to clean up the stack, and the library
will have been expecting the caller to do the cleanup, so nobody cleaned up
The error message was telling you that ctypes pushed 4 bytes of argument
onto the stack which weren't popped off by the caller. If you had been
using the correct calling convention that would have indicated you had
passed too many arguments, but as you were using the wrong calling
convention the message was a bit unclear.
Duncan Booth http://kupuguy.blogspot.com
More information about the Python-list