This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] Fix PR 38536


Dear Thomas,

Thomas Koenig wrote:
I applied your patch with the test reversed and tested it with the
following source:

[...]
   interface
      subroutine fun(arg) BIND(C)
        use iso_c_binding
        type(c_ptr) :: arg
[...]
void fun(void *);

The interface does not really match. On the Fortran side, you have "void **" on the C side you only have "void *". Try:


type(c_ptr), VALUE :: arg


The result is then:


0x7fffc66564c0 3 5
0x7fffc66564c4 5 7
           3           5           7

C Binding is described at http://gcc.gnu.org/onlinedocs/gfortran/Mixed_002dLanguage-Programming.html -- and the pointer handling in particular at http://gcc.gnu.org/onlinedocs/gfortran/Working-with-Pointers.html

Side remark: If it were not for a C_LOC example, I had used "int *" on the C side and "integer(c_int) :: arg(*)" on the Fortran side.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]