[Cffi-devel] Fw: Fw: Help perfecting my GC finalizer/constructor

Martin Simmons martin at lispworks.com
Mon Apr 28 17:15:19 UTC 2014


>>>>> On Mon, 28 Apr 2014 07:26:07 +0200, Willem Rein Oudshoorn said:
> Cancel-Lock: sha1:zqpk08tO/PaCrz3PLTlI+ocAF9E=
> 
> Joeish W <joeish80829 at yahoo.com> writes:
> 
> > How do I work with the metaobjects(is that what they are called)
> > output by the code you gave me...If you can show me how to mem-aref
> > one I would really appreciate it
> 
> Sorry for the short answer, but at the moment I am extremely busy.
> If you followed the example
> 
>  (mem-aref (c-pointer YOUR-POINT) ...)
> 
> should work.

It might be interesting (or scary depending on your point of view) to consider
what happens if the variable YOUR-POINT is the last reference to the CLOS
object here...the finalizer might free the foreign object before mem-aref is
entered if the compiler no longer keeps a pointer to the variable.

Or more specifically, can this ever be safe?

(mem-aref (c-pointer (point0)) ...)

__Martin




More information about the cffi-devel mailing list