FortranGIS  Version2.5
List of all members
c_ptr_ptr Type Reference

Fortran derived type for handling void**, char**, etc C objects (pointer to pointer or array of pointers). More...

Detailed Description

Fortran derived type for handling void**, char**, etc C objects (pointer to pointer or array of pointers).

The array of pointers is assumed to be terminated by a NULL pointer. Methods are provided both for receiving the data structure from C and unpacking it in Fortran as well as for creating it in Fortran and passing it to C.

Example of char** object created in C and unpacked in Fortran:

TYPE(c_ptr_ptr) :: envp
INTEGER :: i
...
envp = c_ptr_ptr_new(interfaced_c_procedure())
DO i = 1, c_ptr_ptr_getsize(envp)
print*,i,trim(strtofchar(c_ptr_ptr_getptr(envp, i),100))
ENDDO
CALL delete(envp)

Example of char** object created in Fortran and passed to C:

TYPE(c_ptr_ptr) :: envp
...
envp = c_ptr_ptr_new((/'APPLE=3 ','PEAR=2 ','ORANGE=20'/))
CALL interfaced_c_procedure(c_ptr_ptr_getobject(envp))
CALL delete(envp)
...

Definition at line 133 of file fortranc.F90.