It might be a little late, but your problem is that you are not linking in my_module
when building my_wrapper
:
wrapper = Extension('my_wrapper', sources=['my_wrapper.f90'], libraries=['my_module'])
setup(
libraries = [('my_module', dict(sources=['my_module.f90'],
extra_f90_compile_args=["-ffixed-form"]))],
ext_modules = [wrapper]
)
If your only use of my_module
is for my_wrapper
, you could simply add it to the sources of my_wrapper
:
wrapper = Extension('my_wrapper', sources=['my_wrapper.f90', 'my_module.f90'],
extra_f90_compile_args=["-ffixed-form"])
setup(
ext_modules = [wrapper]
)
Note that this will also export everything in my_module
to Python, which you probably don't want.
I am dealing with such a two-layer library structure outside of Python, using cmake
as the top level build system. I have it setup so that make python
calls distutils to build the Python wrappers. The setup.py
s can safely assume that all external libraries are already built and installed. This strategy is advantageous if one wants to have general-purpose libraries that are installed system-wide, and then wrapped for different applications such as Python
, Matlab
, Octave
, IDL
,..., which all have different ways to build extensions.