Python ctypes and mutable strings calling Fortran DLL: Access Violation Error -
i trying call subroutine in fortran dll requires 3 mutable strings passed it. subroutine of form:
subroutine getinfo(string_1, string_2, string_3, index) char *60 string_1, string_2 char *30 string_3 string_1 = "string 1 return value" string_2 = "string 2 return value" string_3 = "string 3 return value" end subroutine
im calling function in python follows:
dll = ctypes.windll.loadlibrary('library.dll') funcprot = getattr(dll, 'getinfo') funcprot.argtypes = [ctypes.c_char_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_char_p, ctypes.c_long, ctypes.c_long] string_1 = ctypes.create_string_buffer(60) string_2 = ctypes.create_string_buffer(60) string_3 = ctypes.create_string_buffer(30) funcprot(string_1, 60, string_2, 60, string_3, 30, 701)
i following error.
windowserror: exception: access violation reading 0x000002bd
i tried suggestions post, didn't help.
what doing wrong? thank help.
Comments
Post a Comment