Subject: [clisp-list] FFI:foreign-address function

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Mon Mar 10 04:48:14 2003

Aurelio Bignoli wrote:
> > Note how I passed (FOREIGN-ADDRESS dest)
>I couldn't find it:

It looks like I forgot to submit a patch implementing the foreign-address constructor/extractor. I'm sorry about that. Here it is:

http://sourceforge.net/tracker/index.php?func=detail&aid=700802&group_id=1355&atid=301355

As a quick hack & stop-gap measure, here's one version from "my FFI Lisp hacks toolbox #1", sent to the list on April, 12th 2002:

(in-package "FFI")
(defun foreign-address (foreign)
  (etypecase foreign
     (ffi:foreign-address foreign)
     ((or ffi:foreign-variable ffi:foreign-function)
      (sys::%record-ref foreign 1))))

You ought to wrap this inside
(unless (fboundp 'foreign-address)
  (defun ...))
until you get an official CLISP with the foreign-address function already in it.

The patch file in sourceforge contains a C implementation instead, and documentation.

Regards,
	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Mon Mar 10 09:16:10 2003

> * In message <[email-masked]>
> * On the subject of "[clisp-list] FFI:foreign-address function"
> * Sent on Mon, 10 Mar 2003 13:45:53 +0100
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> Aurelio Bignoli wrote:

or just

(defun foreign-address (o)
  (ffi::unsigned-foreign-address (ffi::foreign-address-unsigned o)))

(works right now!)

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Whom computers would destroy, they must first drive mad.