On Tue, Dec 7, 2010 at 11:11 AM, Alex van der Spek <span dir="ltr"><<a href="mailto:zdoor@xs4all.nl">zdoor@xs4all.nl</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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.<br>

<br>
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?<br>

<br>
For reference: I am using Python 2.6.1 FORTRAN powerstation 4.0. It is not an option to translate the FORTRAN code to C (using f2c) as the source code is the official ASME version of calculating steam tables.<br><br></blockquote>
<div><br></div><div>I've done it before by creating C wrapper function and it was relatively painless, using C wrappers means that it's much easier to integrate into other languages as well if you need to do more integration down the line.</div>
<div><br></div></div>Katie<br>-- <br>CoderStack<br><a href="http://www.coderstack.co.uk" target="_blank">http://www.coderstack.co.uk</a><br>The Software Developer Job Board<br>