[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FF Interface



I am trying to pass float values to and from c functions.  Everything seems
to work fine unless I compile my c code using the -elems881 -mc68881 options
with the MPW C compiler.  The passed values are either received as zero or I
get a floating point error.  I boiled it down to a small example, taken
from the "ff examples" folder.

;; C-code

double add_flt (x, y)
	double x,y;
	{
	   return x + y;
	}

;; compiled with:

C -mc68020 -elems881 -mc68881 -t -r bug.c

;; loaded into MCL with:

(require :ff)

(defparameter *code-libraries*
  '(
    "marconi:mpw:libraries:clibraries:stdclib.o"
    "marconi:mpw:libraries:libraries:interface.o"
    "marconi:mpw:libraries:clibraries:clib881.o"
    "marconi:mpw:libraries:clibraries:csanelib881.o"
    "marconi:mpw:libraries:clibraries:math881.o"
    ))

(ff-load "marconi:mcl 2.0.1:examples:ff examples:bug.c.o"
         :ffenv-name 'test
         :libraries *code-libraries*)

(deffcfun (add-flt "add_flt") (float float) :float)

------------------------------------------------------------------

The above code works if the c file is compiled without the coprocessor
switches.  I am running this on a Centris 650.

-Ron Wallace