title: When creating a Fortran 90 shared library, how can arrange it so that I can access the modules the library uses?
body: <p>I am creating a Fortran 90 shared library and its Python bindings. I need to adjust it so that the user will have access to the shared library's modules when using both Fortran and Python. </p>
  
  <p>Python part is easy, I will create signature files and use <code>f2py</code>. Then the modules will be universally accessible.</p>
  
  <p>However the user will need to access the modules also in Fortran. For this, the user will need the <code>.mod</code> files. </p>
  
  <ul>
  <li>I am reluctant to distribute the <code>.mod</code> files and install with the library because it's unorthodox. </li>
  <li>I also don't want to make the user copy the files that define the modules into their own project every time they need to access one.</li>
  </ul>
  
  <p>It is also useful to say that I am using <code>NumPy</code>'s build system which utilizes Python. Specifically <code>numpy.distutils</code>.</p>
  
  <p>So here is my solution:</p>
  
  <ul>
  <li>I will define the modules inside header files, one header file for each module.</li>
  <li>During the compilation of the library itself, for each header file <code>foo.h</code>, there will be a corresponding <code>foo.90</code> in <code>src/modules</code> containing a single line:</li>
  </ul>
  
  <pre>
  include  'foo.h'
  </pre>
  
  <p>This way, the library will have access to the modules.</p>
  
  <ul>
  <li>For the user, when using the library, if the user wants to access the module <code>foo</code> the user will include the line</li>
  </ul>
  
  <pre>
  include 'foo.h'
  </pre>
  
  <p>once, in any file they want. This way <code>.mod</code> files will be generated in user's own directory, and the project would be compiled, giving the user access to those parts of memory the modules reside in.</p>
  
  <p>Does this seem reasonable? Is there any other way you know that is better and less hacky (that does not involve the distribution of the <code>.mod</code> files)?</p>