[comp.lang.fortran] Interfacing f77 with Common Lisp problems

jan@lipari.usc.edu.UUCP (11/19/87)

Can someone out there help me with the foreign function
interface of Common Lisp running on a Sun 3/260?

The problem is as follows:

I am trying to call a fortran77 function from lisp.
So far all works fine except, except that I don't
seem to be able to write anything to output, or to
a file for that matter, from a fortran routine.
All it does is create the file (for std. output this
is fort.6) and only occasionally writes something into
this file. The command "call flush(6)" helps a bit with that.

To load the fortran function and libraries I do the following
in Lisp:

(define-fortran-function foo (S i)  :result-type :integer)
(load-foreign-files '("foo.o") '("-lU77" "-lF77" "-lI77" "-lc"))

where foo.o is the f77 -c foo.f of something like:

	Integer function foo(S,I)
	Integer i
	character*10 s
	print*, "WhyDoesN'T ThisPRINT", i
	....
C	More irrelevant stuff
	....
	foo = i+1
	return
	end

I tried all kinds of things (formatted output, creating new files, 
etc), but nothing has worked so far. When foo is linked with a regular
fortran program, it works just fine.

Anyone have an idea? My impression is that somehow some print buffer 
doesn't get "flushed" to regular output but I have no clue on what to do 
about that.

Any suggestions are greatly appreciated.

Jan

jan%lipari@oberon.usc.edu




  arpa: jan%lipari@oberon.usc.edu
	vdb@usc-cse.csnet (or vdb%usc-cse@csnet-relay.arpa), vdb@usc-cse.usc.edu
  uucp:  ..!{{decvax,ucbvax}!sdcsvax,hplabs,allegra,trwrb}!sdcrdcf!uscvax!vdb