Good morning, i need to pass a array of string to fortran module by ctypes
This is the python code to pass a array to module fortran:
import ctypes as ct
files = [b"FILE1.RSX", b"FILE2.RSX"]
file_ptrs = (ct.c_char_p * len(files))(*files)
lib2 = ct.CDLL('./reader.so')
lib2.read_data.argtypes = [ct.POINTER(ct.c_char_p)]
lib2.read_data(file_ptrs)
how i can read this array of string into fortran module?
subroutine read_rsx(files) bind(c, name="read_data")
use iso_c_binding
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
integer(c_int), value :: numFile
type(c_ptr), intent(in) :: files(numFile)
...
end subroutine read_data