This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: guile and Fortran?
- To: Paul dot Emsley at chem dot gla dot ac dot uk
- Subject: Re: guile and Fortran?
- From: Clark McGrew <mcgrew at ale dot physics dot sunysb dot edu>
- Date: Wed, 31 May 2000 17:36:56 -0400
- CC: guile at sourceware dot cygnus dot com
- References: <200005311710.SAA05471@eriskay.chem.gla.ac.uk>
- Reply-to: clark dot mcgrew at sunysb dot edu
>>>>> "Paul" == Paul Emsley <Paul.Emsley@chem.gla.ac.uk> writes:
Paul> I have an old fortran library that I would like to
Paul> extend with guile (i.e, I want to write scheme programs that
Paul> use these functions).
Paul> What is the best/quickest (hopefully the same) way of
Paul> doing this?
I've found the easiest way is to wrap the functions in C and then use
swig to wrap the C for guile. That sounds a little convoluted, but
since SWIG lets you have inline functions it's not bad.
The basic swig code looks something like this.
%inline{
void yoursub(int ivar, float rvar) {
yoursub_(&ivar,&rvar);
}
%}
would wrap
subroutine yoursub(ivar,rvar)
return
end
I've wrapped a lot of code like this and it's worked pretty well.
Cheers,
Clark