[cffi-devel] Cannot call function with char** arg

Nikolai Nespor nikolai.nespor at utanet.at
Wed Apr 26 21:45:32 UTC 2006


In reply to James Bielman:
> 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)
>      , at body))
> 
> ;;; Do nothing on Lisps that don't need traps disabled.
> #-sbcl
> (defmacro without-fp-traps (&body body)
>   `(progn
>      , at body))

Which does work perfectly well form me! Thanks a lot.

> 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...

Neither am I (unfortunately).

Thanks again,

Nikolai
-- 
Ich verwalte sie. Ich zähle sie und zähle sie wieder.
Das ist nicht leicht. Aber ich bin ein ernsthafter Mann.
\\
 ---> Antoine de Saint-Exupery, "Der kleine Prinz"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20060426/f91475c3/attachment.sig>


More information about the cffi-devel mailing list