[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: good examples of Emacs modules?
From: |
Óscar Fuentes |
Subject: |
Re: good examples of Emacs modules? |
Date: |
Fri, 01 Apr 2016 15:25:42 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.92 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
> I think you want to wrap some kind of "handle" that is meaningful to
> libgit2 into a user-ptr object (see the existing docs about modules
> for details about these). A user-ptr object has a finalizer, a
> function that is called by GC when the object goes out of scope.
This means that GCing the object is unpredictable, right? Also, if the
API uses a struct as the session object, you need to store it somewhere
and expose a pointer to it to the Elisp code; that is, you can't put
arbitrary data on the Elisp memory space.
> The
> finalizer function should do whatever libgit2 needs to close the
> session and free whatever resources the session used.
>
> You have a demo if using a user-ptr in modules/mod-test/.
Thanks.