title: How can I pass a Vector from C++ to Fortran?
body: <p>I have a code in C++ and I would like to call some functions in Fortran. I have the following function </p>
  
  <pre><code>Vector3d CWLiDAR__get_position(CWLiDAR* This)
  {
      return This-&gt;get_position();
  }
  </code></pre>
  
  <p>There is a wrapper in Fortran:</p>
  
  <pre><code>module CWLiDAR_module
      use, intrinsic :: ISO_C_Binding
      implicit none
  
      private
      type CWLiDAR_type
          private
          type(C_ptr) :: object = C_NULL_ptr
      end type CWLiDAR_type
  
      interface    
          function C_CWLiDAR__get_position (this)  result(pos)  bind(C, name="CWLiDAR__get_position")
              import
              type(C_ptr), value                          :: this
              real(C_double), intent(out), dimension(*)   :: pos
          end function C_CWLiDAR__get_position
      end interface
  
      interface get_position
          module procedure CWLiDAR__get_position
      end interface get_position
  
  
      public :: get_position, CWLiDAR_type
  
  
      contains
  
      function CWLiDAR__get_position(this) result(pos)
          type(CWLiDAR_type), intent(in)                  :: this
          double precision, dimension(0:3)                :: pos
  
          pos = C_CWLiDAR__get_position(this%object)
      end function CWLiDAR__get_position
  
  end module CWLiDAR_module
  </code></pre>
  
  <p>However I am getting the following compilation error:</p>
  
  <pre><code>     function C_CWLiDAR__get_position (this)  result(pos)  bind(C, name="CWL
                                                              1
  Error: Assumed size array at (1) must be a dummy argument
           function C_CWLiDAR__get_position (this)  result(pos)  bind(C, name="CWL
          1
  Error: Assumed size array at (1) must be a dummy argument
  </code></pre>
  
  <p>How can I pass a Vector3D to Fortran?</p>