Both cffi:pointer-eq or cffi:null-pointer-p would do the trick, that's a bug in the code, but the problem comes by the fact that null is returned by the foreign call and it shouldn't. And when you do the same steps in the repl without relying on the high level interface it works as expected and no null is returned. In my former reply I just pointed to the shocking behaviour of all equality predicates in SBCL which always fail at comparing two null pointers.



2013/11/26 Stas Boukarev <stassats@gmail.com>
Hugo Cienfuegos Suárez <hugocientos@gmail.com> writes:

> Wow, it looks odd that
> (eq (cffi:null-pointer) (cffi:null-pointer))
> (eql (cffi:null-pointer) (cffi:null-pointer))
> (equal (cffi:null-pointer) (cffi:null-pointer))
> (equalp (cffi:null-pointer) (cffi:null-pointer))
> All give NIL as result.
Maybe I missed it in the previous replies, but wouldn't you want
cffi:pointer-eq?

--
With best regards, Stas.