2 ! This should compile, though there is a warning about the type of len
3 ! (return variable of strlen()) for being implicit.
9 CHARACTER(C_CHAR), DIMENSION(1), SAVE, TARGET, PRIVATE :: dummy_string="?"
11 FUNCTION C_F_STRING(CPTR) RESULT(FPTR)
12 use, intrinsic :: iso_c_binding
13 TYPE(C_PTR), INTENT(IN) :: CPTR ! The C address
14 CHARACTER(KIND=C_CHAR), DIMENSION(:), POINTER :: FPTR
16 FUNCTION strlen(string) RESULT(len) BIND(C,NAME="strlen") ! { dg-warning "Implicitly declared" }
18 TYPE(C_PTR), VALUE :: string ! A C pointer
21 CALL C_F_POINTER(FPTR=FPTR, CPTR=CPTR, SHAPE=[strlen(CPTR)])
23 END MODULE ISO_C_UTILITIES
24 ! { dg-final { cleanup-modules "iso_c_utilities" } }