Fortran-compiled DLLs in Python

byte biscuit stephen.mcphail at casaccia.enea.it
Thu May 27 05:36:23 EDT 2004


Hi there everybody!
The problem is the following:
we have a DLL (H2O.dll) - compiled in Visual Fortran - depending in turn on
another DLL.
H2O.dll contains only one (1) function, with a known name (WATER).
The WATER function is called with the following parameters:
- TT (datatype: double precision)                                    [input]
- PP (datatype: double precision)                                    [input]
- State (datatype: integer)
[input]
- DiERR (datatype: integer)
[output]
- SIG (datatype: double precision)
[output]
- Prop (datatype: double precision array[16 elements])   [output]

Obviously, we would like to make use of Python to handle the function and
pick out the results...
We thought of using the **ctypes** module to tackle the problem, but we have
stranded just about at the first attempt:

>>> from ctypes import *
>>> h2o = windll.H2O
>>>
h2o.WATER(c_long(40.0),c_long(1.0),c_int(2),c_int(dierr),c_int(Sig),c_long*1
6(prop))
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: int expected instead of float instance

Who can show us the Right way, riding the Python? THANKS!

stephen





More information about the Python-list mailing list