title: Calling Fortran from Python using CFFI
body: <p>I am trying to reproduce <a href="http://scientific-software-diary.com/?p=29" rel="nofollow noreferrer">this example</a> on Windows. Here are the corresponding fortran codes</p>
  <blockquote>
  <p>fortran_wrapper.f90</p>
  </blockquote>
  <pre><code>MODULE FORTRAN_WRAPPER
  
  USE ISO_C_BINDING, ONLY: C_INT
  USE YOUR_FORTRAN_MODULE
  
  IMPLICIT NONE
  
  CONTAINS
    SUBROUTINE C_WRAPPER_YOUR_SUBR(ARG1) BIND(C, NAME = &quot;C_WRAPPER_YOUR_SUBR&quot;)
  
       INTEGER(C_INT), INTENT(IN), VALUE :: ARG1  
  
       CALL YOUR_SUBR(ARG1)
  
    END SUBROUTINE C_WRAPPER_YOUR_SUBR
  
  END MODULE FORTRAN_WRAPPER
  </code></pre>
  <blockquote>
  <p>fortran_code.f90</p>
  </blockquote>
  <pre><code> MODULE YOUR_FORTRAN_MODULE
  
    CONTAINS
    
      SUBROUTINE YOUR_SUBR(ARG1)
  
       IMPLICIT NONE
  
       INTEGER, INTENT(IN) :: ARG1
  
       WRITE(*,*) 'The values is: ', ARG1
  
     END SUBROUTINE YOUR_SUBR
  
   END MODULE YOUR_FORTRAN_MODULE
  </code></pre>
  <p>Here is the corresponding calling python code</p>
  <blockquote>
  <p>python_prog.py</p>
  </blockquote>
  <pre><code>from cffi import FFI
  import os
  ffi = FFI()
  dll_path = os.path.join(os.path.dirname(__file__), 'dll_name.dll')
  lib = ffi.dlopen(dll_path)
  
  ffi.cdef(&quot;void C_WRAPPER_YOUR_SUBR(int arg1);&quot;)
  
  arg1 = 1
  
  lib.C_WRAPPER_YOUR_SUBR(arg1)
  </code></pre>
  <p>The <code>dll_name.dll</code> was created using intel fortran compiler in the following way</p>
  <p><code>ifort /dll fortran_code.f90 fortran_wrapper.f90 /exe:dll_name.dll</code></p>
  <p>After running the <code>python python_prog.py</code> I got the following error</p>
  <p><code>AttributeError: function/symbol 'C_WRAPPER_YOUR_SUBR' not found in library 'dll_name.dll': error 0x7f</code></p>
  <p>I would appreciate any help.</p>