I'm trying to use a DLL that I have used many times in other languages including C, Java, Perl, etc so I am pretty familiar with the library, but I didn't write it. It came from a comercial source.

I'm using ctyps to load the library as such:

from ctypes import *

piapi = windll.piapi32
findpoint = piapi.pipt_findpoint

findpoint.restype = c_int
findpoint.argtypes = [c_char_p, c_int]

ptid = []

retVal = c_int()

tag = create_string_buffer('\000' * 32)
ptid[0] = 0

tag.value = str(input("Enter a tag name:"))

retVal = piapi.pipt_findpoint(tag[0], ptid[0])

I have tried a number of different combinations on the arguments but all of them return a value of 2. The function should return 0 if successful, > 0 if the problem is with the data source and > 0 if the problem is a system problem.

So what system problem is "2"? Is there a listing of error codes to error messages in Python?


PS here's the header entry for the function: PIINT32 pipt_findpoint( char PIPTR *tagname, int32 PIPTR *pt );

If a call to the DLL returns '2' then that's not a Python error code, that's just what the DLL is returning. I'd suggest using the DLL in another language in the same way to see if you get the same error code.