[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fortran foreign functions
- To: firstname.lastname@example.org
- Subject: Re: Fortran foreign functions
- From: Greg Anglin <email@example.com>
- Date: Thu, 24 Feb 1994 12:00:22 -0500
- Cc: firstname.lastname@example.org, email@example.com
>>Does the foreign function interface in MCL support Fortran code.
>>appears to have direct support for C and Pascal, but does anyone
>>idea how difficult interfacing to Fortran (i.e. Language Systems
>>code would be? I know that this Fortran compiler spits out MPW
>>files, but I suspect that there is more to it than that.
>My seive of a brain thinks it remembers someone doing this, but
>I'm not sure about it. FF-LOAD will certainly know how to link
>the Fortran code. The only difficulty I can think of is if the
>Fortran calling sequence is different from C or Pascal. Language
>Systems should be able to tell you about that.
Language Systems Fortran works fine with the FF interface.
The macro defffun, documented in the FF chapter of the MCL manual,
is specific to Fortran and handles the issue of the calling
sequence (Fortran passes args in reverse order from C).
1. I have been unable to get I/O from Fortran or C.
2. I haven't figured out where Fortran FUNCTIONs return their
values; in all of my code I use Fortran SUBROUTINEs, and modify
By the way,
1. You can pass arrays of values to C or Fortran by allocating
memory with _newptr, and carefully filling in/retreiving values
using %put-long, %get-long, %put-double, and %copy-float. Use
type t to describe the argument to defffun/deffcfun, and pass
2. It is possible to callback from Fortran to Lisp via C. I
think I could reconstruct what I did if you need to do this.
Sorry I missed the original post. I hope this helps.
Statistical Computing Laboratory
University of Waterloo