Python/Fortran interoperability

nmm1 at cam.ac.uk nmm1 at cam.ac.uk
Mon Aug 24 21:24:35 CEST 2009


In article <7abee4bb-b18a-4680-817b-7e76aed40194 at c2g2000yqi.googlegroups.com>,
sturlamolden  <sturlamolden at yahoo.no> wrote:
>
>> Precisely. =A0And the kludge does NOT work under all circumstances,
>> which is why I said that it doesn't work very well.
>
>Do you have an example?

I gave you one.  Also see below.

>> Consider, for example:
>>
>> =A0 =A0 SUBROUTINE Fred (X) BIND(C)
>> =A0 =A0 CHARACTER*(*) :: X
>> =A0 =A0 END SUBROUTINE Fred
>
>Obviously that is not allowed, because C does not know anything about
>Fortran strings. How should a C compiler pass the correct data
>structure to Fred?

Precisely.  The reason I asked that question is that it would be
possible to extend the standard to make it possible in a portable
fashion.

You might also like to consider the converse problem: how to write
a Fortran function that takes a C string of arbitrary length and
uses it.


Regards,
Nick Maclaren.



More information about the Python-list mailing list