I have a fortran static library and I need to call it from python. Can somebody give me an example of how to do that.
I do believe F2py is what you need. F2py makes it easy to construct extension modules that interfaces to routines in Fortran 77/90/95 code.
The following URL will provide you with some examples on how to use F2py, aka f2py: http://docs.scipy.org/doc/numpy-1.10.1/user/c-info.python-as-glue.html
The following link will also provide you useful information about F2py, aka f2py: http://docs.scipy.org/doc/numpy-dev/f2py/usage.html
The documentation includes detailed about both the module and the command-line interface.
Let me know whether the information I provided you has helped you. Feel free to add any additional comments to this thread in case you need more details. I've been mixing Fortran with Python in the last months. :)
I use this command: f2py -c -m CoreSolver CoreSolver.lib but I get the next error: Unable to find vcvarsall.bat. I have to say that the static library use imsl library, maybe this could be problematic.
Thanks for the help
The one you mention is a typical problem with f2py.
You can find helpful information to solve this problem in the following thread: https://code.google.com/archive/p/rdflib/issues/104#c4
Few years ago, there was a Numpy discussion about this issue that is the most referenced one and will definitely help you: https://firstname.lastname@example.org/msg30016.html. This one links to the previously mentioned thread.
Hope it helps.
In case the solution provided was useful, don't forget to provide feedback to this thread. This way, whenever somebody has a similar problem, he/she will search within the forums, find this thread and know that the solutions provided have solved your issue.