Python ctypes argument errors

Posted by Patrick Moriarty on Stack Overflow See other posts from Stack Overflow or by Patrick Moriarty
Published on 2011-03-10T23:59:10Z Indexed on 2011/03/11 0:10 UTC
Read the original article Hit count: 257

Filed under:
|
|

Hello. I wrote a test dll in C++ to make sure things work before I start using a more important dll that I need. Basically it takes two doubles and adds them, then returns the result. I've been playing around and with other test functions I've gotten returns to work, I just can't pass an argument due to errors. My code is:

import ctypes
import string

nDLL = ctypes.WinDLL('test.dll')
func = nDLL['haloshg_add']
func.restype = ctypes.c_double
func.argtypes = (ctypes.c_double,ctypes.c_double)
print(func(5.0,5.0))

It returns the error for the line that called "func":

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

What am I doing wrong? Thanks.

© Stack Overflow or respective owner

Related posts about python

Related posts about dll