title: Modifying a Fortran array in C
body: <p>In Fortran I have a an array specified as:</p>
  
  <pre><code>dimension insv(*)
  </code></pre>
  
  <p>Now I would like to edit this array from C.
  I managed to read the array from C by using the iso_c_binding:</p>
  
  <pre><code>  SUBROUTINE userroutine(insv)
    IMPLICIT NONE
    INTERFACE
    SUBROUTINE MODIFYARRAY(insv) BIND(C)
    USE, INTRINSIC::ISO_C_BINDING
       REAL(C_DOUBLE),DIMENSION(*), INTENT(INOUT) :: insv
    END SUBROUTINE MODIFYARRAY
    END INTERFACE
  
    dimension insv(*)
  
    WRITE(insv(0))
    call modifyarray(insv)
    WRITE(insv(0))
    END
  </code></pre>
  
  <p>My C function:</p>
  
  <pre><code>__declspec(dllexport) void modifyarray(double * insv)
  </code></pre>
  
  <p>But modifying a value in this array in C either crashes or simply doesnt get changed at all.</p>
  
  <pre><code>__declspec(dllexport) void modifyarray(double * insv)
  {
      insv[0] = 1234.00;
  }
  </code></pre>
  
  <p>Im not sure as to what i should change to the iso_c_binding or the C function to make this work.</p>
  
  <p>Some more context: The fortran array type cannot be changed since the dimension variable is a parameter of a userroutine, not in my control, so to say.
  The array is already filled when entering the fortran function, but needs to be modified in C.</p>