title: Error when Passing matrices from MATLAB to FORTRAN dll
body: <p>I have a simple intel fortran dll compiled from below:</p>
  
  <pre><code>function  add1(A,n)
  !Expose  function  add1  to  users  of  this  DLL
  !DEC$ ATTRIBUTES  C,DLLEXPORT:: add1
  implicit none
  double  precision  A(n,n),add1(n,n)
  integer n
  call add2(A,n)
  A=A+1.0
  add1=A
  end  function  add1
  
  subroutine add2(a,n)
  double precision a(n,n)
  integer n
  a=a+1
  endsubroutine
  </code></pre>
  
  <p>I also have a header file for the dll:</p>
  
  <pre><code>double* add1(double*,int);
  </code></pre>
  
  <p>I use MATLAB to load the dll:</p>
  
  <pre><code>library='trydll.dll';
  header='add1.h';
  loadlibrary(library, header);
  n=3;
  haha=ones(n,n);
  A=calllib('trydll','add1',haha,n)
  unloadlibrary('trydll')
  </code></pre>
  
  <p>The sent matrix and the integer to the dll are severely wrong, and seem to be random numbers in the memory. Anyone has any idea where the mistake is?</p>