Re: Calling FORTAN dll functions from Python

On Dec 7, 3:11 am, "Alex van der Spek" <zd...@xxxxxxxxx> wrote:
Does anyone know how to call functions from FORTRAN dlls in Python? Is it
even possible? I browsed the documentation for Python 2.6.1 and the Python/C
API comes close to what I would like to do but it is strictly limited to C.

Unfortunately the passing of arguments in C and FORTRAN is very different,
not to mention the differences with strings where FORTRAN expects a hidden
length argument. It could call the FORTRAN dll from C and call the C
functions from Python but is that my only option?

I'd recommend f2py, which is part of the numpy package.

Carl Banks

Relevant Pages

  • Re: calling a function that returns a c_char from python
    ... compiler used, the output in python is right or wrong. ... The problem could lie either on the python side or the Fortran side. ... character arguments was defined in f77. ...
  • Re: Attempting to allocate already allocated array?
    ... and I've written a good enough Python wrapper. ... If the python array is C contiguous (numpy arrays can be either Fortran or C contiguous under the hood, without you knowing it) you risk copying these arrays on entry to SUDA, just to get them on Fortran form. ... To do that I need to compare the SUDA (Special Uniques Detection Algorithm) approach, of which the unique itemset mining is a part, with an alternative. ...
  • Re: New to Python: Features
    ... > compile-time checking of procedure calls) were fixed in Fortran 90. ... alternative language possibilities for my employer of the time, ... By directly attacking pyrex as "not mature", ... > language like Python is good old C. ...
  • Re: Python for Fortran programmers
    ... proposition for Python in the Fortran community", ... compiled language such as Fortran or C++, but I would still prefer to ... greater number of programming errors that are typically detected by a ...
  • Re: Fortran vs Python - Newbie Question
    ... I've been told that Both Fortran and Python are easy to read, ... creating number crunching apps over Fortran?? ... serious numerical computation these days is large-scale) without ...