[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp object that refers to a C struct

From: Eli Zaretskii
Subject: Re: Lisp object that refers to a C struct
Date: Wed, 17 Oct 2012 18:08:54 +0200

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> Date: Wed, 17 Oct 2012 09:34:40 -0400
> >> What happens if someone passes you this same integer some time after
> >> you've freed the C struct?
> > It won't be found in the list of watches, so the command to remove
> > that watch will say "Invalid watch descriptor", and Lisp-level code
> > will not find the corresponding Lisp data structure.
> So the integer doesn't encode the pointer, instead it's an index into
> a table of C structs.

No, I have no table right now.  I could add one, of course.

Right now, the struct is allocated and its pointer is put into an
alist as a Lisp integer, and also returned, as a Lisp integer, to the
caller of the "start-watching" API.  The caller is supposed to manage
her watches, and pass the right integer when she wants to cancel a

reply via email to

[Prev in Thread] Current Thread [Next in Thread]