Lisp HUG Maillist Archive

Little issue with CFFI

Hello all,

I am trying to compie this code in Lispworks:

(defun ge-get-var-values (sp n var-array)
  (let ((the-result (ge-make-pointer (* n 4)))  a-list)
        (setf a-list (cons (ge-read-ptr the-result (* i 4) ) a-list))))

(defun gelisp::ge-make-pointer (size &optional (clear nil))
 (cffi::foreign-alloc :int :count (coerce size 'integer)))

(defun gelisp::ge-read-ptr (ptr pos )
     (cffi::mem-aref ptr :int pos))

And I am getting this error:

**++++ Error in GELISP::GE-GET-VAR-VALUES: 
  THE-RESULT if not a  FOREIGN OBJECT

Is there a way to "coerce" foreign object variables as it is done with integers?

Thanks,

Mauricio

--
Mauricio Toro Bermudez
Estudiante de Ingeniería de Sistemas
Pontificia Universidad Javeriana, Colombia

Stagiare à l'Ircam
1, place Igor-Stravinsky 75004 Paris,
France de 2008 à 2009

Re: Little issue with CFFI

Unable to parse email body. Email id is 8387

Updated at: 2020-12-10 08:42 UTC