[Tutor] ValueError: Procedure probably called with too many arguments (8 bytes in excess)

Brad M thebigwurst at gmail.com
Sat May 5 21:49:22 EDT 2018


Hi all:

I am experimenting with python calling some .DLL and this is my setup:

scan.py
memscan = ctypes.WinDLL('mahdll', use_last_error=True)
print(memscan.say_something(1,2))

# So I pass to int to the DLL function.


DLL:

#include <stdio.h>

__declspec(dllexport) int say_something(int a, int b)
{
printf("Hello World");
return math(a, b);
}

int math(int a, int b)
{
return a + b;
}




# So I found it wont print "hello world"
and it give this error:

ValueError: Procedure probably called with too many arguments (8 bytes in
excess)

# Also, if I pass no argument to the function, it won't printf("Hello
world")
on the python interpreter or opens a console window to print it.


So what's the right thing to do to pass arguments to a DLL function?

Thanks!


More information about the Tutor mailing list