haviland@uvm-gen.UUCP (Tom Haviland) (09/24/87)
I have an interesting problem I wonder if anyone out there might have
experienced. I'm writing a menu system to go with a fortran modelling
package, and since supposedly microsoft C and FORTRAN work together, I
wrote the menu system in C. I've set up an INTERFACE block in the fortran
program to call the C routines, and it seems to call the routine ok, but
when the C routine calls the fscanf() function, reading floating point
numbers from a file (%f) I get an error "Floating point not loaded" and
the program stops. Now the C routines do some floating point calculations
before this point and that works ok. Also, fscanf() works ok reading
integers. I'm doing this on an AT&T 6300 with an 8087. In the FORTRAN
routines the $nofloatcalls option is on (generate 8087 inline code), and
I've tried compiling the C routines with several different floating point
options (FPi, FPi87, FPc), but I still get this error. Does anyone out
there have any idea whats going on?
Thanks for any help
Tom
--
Thomas P. Haviland
USENET: decvax!dartvax!uvm-gen!haviland University of Vermont
CSNET: haviland%uvm@csnet-relay (802) 656-2540
"Knowledge is no substitute for retractability"kwh@sei.cmu.edu (Kurt Hoyt) (09/27/87)
In article <582@uvm-gen.UUCP> haviland@uvm-gen.UUCP (Tom Haviland) writes: > > I have an interesting problem I wonder if anyone out there might have >experienced. I'm writing a menu system to go with a fortran modelling >package, and since supposedly microsoft C and FORTRAN work together, I >wrote the menu system in C. I've set up an INTERFACE block in the fortran >program to call the C routines, and it seems to call the routine ok, but >when the C routine calls the fscanf() function, reading floating point >numbers from a file (%f) I get an error "Floating point not loaded" and >the program stops. Now the C routines do some floating point calculations > Thomas P. Haviland Your problem isn't in the compiling -- its in the linking. If you link from FORTRAN instead of from cc, the proper library for scanf/printf for floating point numbers isn't linked. See page 367 of the C compiler user's guide manual: "Your program needs the foating-point library, but the library was not loaded. The error causes the program to terminate with an exit status of 255." You need to link in the C floating point library when you link. FORTRAN won't know that you need the C floating point library. Hope this helps. It is a common error when mixing languages. I ran into similar problems mixing C and Ada because Ada didn't link in some startup code that the C code needed, so I had to explicitly tell Ada to link in the C startup code. -- "Why isn't anyone ever happy to | Kurt Hoyt see us?" | ARPA: kwh@sei.cmu.edu -- Arthur Dent | BITNET: kwh%sei.cmu.edu@cmuccvma | CSNET: kwh%sei.cmu.edu@relay.cs.net