[cffi-devel] CFFI and FORTRAN CHARACTER*(*)
Mark Hoemmen
mark.hoemmen at gmail.com
Mon Jun 7 17:12:47 UTC 2010
On Mon, Jun 7, 2010 at 10:56, Martin Simmons <martin at lispworks.com> wrote:
>>>>>> On Sat, 5 Jun 2010 16:12:58 +0200, Juan Jose Garcia-Ripoll said:
>>
>> CHARACTERs in Fortran are just pointers of type char*, just like in C, and
>> just like any other fortran array. There is no terminating null and the
>> fortran functions get the length either from some argument or because they
>> assume a given size (for instance in Lapack it is a one-character string
>> what the function expects)
>
> Are you sure about? I think the lengths are passed as implicit arguments at
> the end of the argumwnt list.
Not on any Fortran compilers I've seen, at least when dealing with
LAPACK. Replacing CHARACTER*(*) with "char* const" when calling
LAPACK routines that take CHARACTER*(*) arguments works perfectly fine
with all the Fortran compilers I've encountered (e.g., gfortran, Intel
Fortran compiler, IBM's xlf).
mfh
More information about the cffi-devel
mailing list