From: glen herrmannsfeldt on 22 Feb 2010 22:27 Jim Xia <jimxia(a)hotmail.com> wrote: (snip) >> type(c_ptr) :: iptr, jptr >> integer, pointer :: i, j >> call foofunc(iptr,jptr) >> call c_f_pointer(iptr,i) >> call c_f_pointer(jptr,j) > j is of type double in C side, and the Fortran side provides an > integer. One big disadvantage of this is Fortran side loses the type > checking for i or j. And don't do this often, otherwise it's begging > for troubles. Type(C_PTR) is not well designed. Yes, j should be a double precision pointer. As with C (void*) it is the programmers responsibility to keep track of this and get it right. -- glen |