Nikolai Nespor <[EMAIL PROTECTED]> writes:

> rrd> (with-foreign-string-vector (argc argv '("create" "test.rrd" 
> "--step=300" "DS:a:GAUGE:600:U:U" "DS:b:GAUGE:600:U:U" 
> "RRA:AVERAGE:0.5:1:300"))
>        (rrd-create argc argv))
>
> I get this error:
>
> arithmetic error FLOATING-POINT-INVALID-OPERATION signalled
>    [Condition of type FLOATING-POINT-INVALID-OPERATION]

I've seen this happen in the glX libraries before.  As I understand
what's happening, SBCL enables floating point traps that are not
normally enabled in C programs, and this can mess things up when
calling foreign code.  What I used to get around this was:

;;; Execute BODY with floating-point traps disabled.  This seems to be
;;; necessary on (at least) Linux/x86-64 where SIGFPEs are signalled
;;; when creating making a GLX context active.
#+sbcl
(defmacro without-fp-traps (&body body)
  `(sb-int:with-float-traps-masked (:invalid :divide-by-zero)
     ,@body))

;;; Do nothing on Lisps that don't need traps disabled.
#-sbcl
(defmacro without-fp-traps (&body body)
  `(progn
     ,@body))

and a WITHOUT-FP-TRAPS form around the offending foreign function
calls.  I'm not enough of a floating-point wizard to know why you'd be
getting that particular trap though...

James
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to