title: How to deal with global variables when calling fortran code in python (e.g. with f2py)?
body: <p>I want to run some fortran codes with python and am using <strong>f2py -c -m</strong> for it. However, it seems that only the <strong>FUNCTIONs</strong> are packed into the <strong>.so</strong> file, but not the <strong>PROGRAM</strong>. How can I deal with global variables then? For example, a variable <strong>c</strong> is put in a module </p>
  
  <pre><code>MODULE nfw
    double precision :: c
  END MODULE nfw
  </code></pre>
  
  <p>,is modified in the PROGRAM, and is used by a FUNCTION in the same file implicitly</p>
  
  <pre><code>PROGRAM Compute_Profile
    USE nfw
    c = 5.0
  END PROGRAM Compute_Profile
  
  DOUBLE PRECISION FUNCTION y(x)
    USE nfw
    double precision :: x
    y = c * x
    return
  END FUNCTION y
  </code></pre>
  
  <p>How can I call let the function <strong>y(x)</strong> know about the value of <strong>c</strong> in python?</p>