- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Juan David,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Juan David,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Juan David,
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. :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Gastón.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Juan David,
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://www.mail-archive.com/numpy-discussion@scipy.org/msg30016.html. This one links to the previously mentioned thread.
Hope it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Juan David,
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.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page