diff --git a/bindings/py3devil1.py b/bindings/py3devil1.py index 61e75b3..7480719 100755 --- a/bindings/py3devil1.py +++ b/bindings/py3devil1.py @@ -7,7 +7,7 @@ class PldHeader(ctypes.Structure): ("offsets", ctypes.POINTER(ctypes.c_int)) ] -class Devil1FN_PLD(ctypes.Structure): +class Devil1PLD_FN(ctypes.Structure): _fields_ = [ ("getheader" , ctypes.CFUNCTYPE(bool, ctypes.POINTER(PldHeader), ctypes.c_char_p)), ("sizeofsector", ctypes.CFUNCTYPE(int, ctypes.POINTER(PldHeader), ctypes.c_int)), @@ -16,11 +16,21 @@ class Devil1FN_PLD(ctypes.Structure): def main(): sharedlib='./lib3ddevil1.so' - libc = cdll.LoadLibrary(sharedlib) - if (not lib): + libc = ctypes.cdll.LoadLibrary(sharedlib) + if (not libc): print("Couldn't load %s" % sharedlib) return 1 - + print("OK") + fn = Devil1PLD_FN.in_dll(libc, "DEVIL1PLD") + pldh = PldHeader() with open("pl01.pld", "rb") as f: data = f.read() + p = PldHeader() + fn.getheader(ctypes.byref(pldh), data) + fn.printheader(ctypes.byref(pldh)) + +#---------------------------------------+ + +main() +