根据@eryksun的评论,我进行了以下更改以使其起作用。
更改
argtypes为:
function2 = getattr(dll, 'FUNCTION2')function2.argtypes = [C.c_char_p, C.c_long, C.c_char_p, C.c_long, C.c_char_p, C.c_long, np.ctypeslib.ndpointer(C.c_long , flags='F_CONTIGUOUS'), np.ctypeslib.ndpointer(C.c_double, flags='F_CONTIGUOUS'), np.ctypeslib.ndpointer(C.c_long, flags='F_CONTIGUOUS')]
并且我没有将字符串传递为
byref,而是将其更改为以下内容。
base_path = "D:\Users\xxxxxxx\documents\xxxxx\".ljust(255)temp_path = "D:\Users\xxxxxxx\documents\xxxxx\temp".ljust(255)inp_file = "inp.txt".ljust(255)function2(base_path, len(base_path), temp_dir, len(temp_dir), inp_file, len(inp_file),model_array, data_array, error_array)
直接传递值就足够了。



