[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
watch.
- Re: Lisp object that refers to a C struct, (continued)
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/15
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/15
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/16
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/16
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/16
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/17
- Re: Lisp object that refers to a C struct, Stephen J. Turnbull, 2012/10/17
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/17
- Re: Lisp object that refers to a C struct, Stephen J. Turnbull, 2012/10/17
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/17
- Re: Lisp object that refers to a C struct,
Eli Zaretskii <=
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/17
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/17
- Re: Lisp object that refers to a C struct, Paul Eggert, 2012/10/17
- Re: Lisp object that refers to a C struct, Stefan Monnier, 2012/10/17
- Re: Lisp object that refers to a C struct, Stephen J. Turnbull, 2012/10/17
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18
- Re: Lisp object that refers to a C struct, Paul Eggert, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18
- Re: Lisp object that refers to a C struct, Paul Eggert, 2012/10/18
- Re: Lisp object that refers to a C struct, Eli Zaretskii, 2012/10/18