Lisp HUG Maillist Archive

Passing Lisp objects to through the FLI?

Is it possible to pass a Lisp object (not a foreign object or a simple literal ala fixnum/string) to a foreign function and be returned later? I assume the big concern would be the garbage collector moving (or even releasing) the memory for the Lisp object, but perhaps #'in-static-area can help here?

Basically, there are some functions I'd like to call that accept a void* for user data. It would be incredibly convenient if I could send a specific or class instance or struct through the user data and get it back later via another foreign function call.

Is that doable somehow? Or, if someone knows a another method, I'm all ears. ;-)

Thanks!

Jeff M.

Re: Passing Lisp objects to through the FLI?


In my OpenRM bindings, I add the Lisp object to a hash table using an  
integer as the key. I then pass the integer in void*.

- Luke

On Tue, 11 Nov 2008 12:59:12 -0800, <massung@gmail.com> wrote:

> Is it possible to pass a Lisp object (not a foreign object or a simple
> literal ala fixnum/string) to a foreign function and be returned later? I
> assume the big concern would be the garbage collector moving (or even
> releasing) the memory for the Lisp object, but perhaps #'in-static-area  
> can
> help here?
>
> Basically, there are some functions I'd like to call that accept a void*
> for user data. It would be incredibly convenient if I could send a  
> specific
> or class instance or struct through the user data and get it back later  
> via
> another foreign function call.
>
> Is that doable somehow? Or, if someone knows a another method, I'm all
> ears. ;-)
>
> Thanks!
>
> Jeff M.



Re: Passing Lisp objects to through the FLI?

Unable to parse email body. Email id is 8773

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