From: Samir Jindel <sjindel@google.com>
To: 30373@debbugs.gnu.org
Subject: bug#30373: Support finalizers for functions created in dynamic modules
Date: Tue, 6 Feb 2018 22:17:11 +0100 [thread overview]
Message-ID: <CAKjqF1Pd3iVFRjVBz1tdBrxycqhQjhevbhuZOois+yRFMggQ0w@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1107 bytes --]
Hi,
I'm very excited by the possibilities opened through the new dynamic module
interface, "emacs-module.h".
However, I have a concern about the API for creating Lisp functions bound
to native functions:
```c
emacs_value (*make_function) (emacs_env *env,
ptrdiff_t min_arity,
ptrdiff_t max_arity,
emacs_value (*function) (emacs_env *env,
ptrdiff_t nargs,
emacs_value args[],
void *)
EMACS_NOEXCEPT,
const char *documentation,
void *data);
```
I presume the "data" pointer here is provided to enable native functions to
work like closures,
carrying additional, possibly dynamically allocated data. However, this
functionality is limited by
the absence of a finalization function pointer, like the "user_ptr" values
have:
```c
emacs_value (*make_user_ptr) (emacs_env *env,
void (*fin) (void *) EMACS_NOEXCEPT,
void *ptr);
```
Without the ability to provide a finalizer, a module can only safely make
the "data" pointer to
"make_function" point to static memory.
Thanks,
Samir Jindel
[-- Attachment #2: Type: text/html, Size: 3780 bytes --]
next reply other threads:[~2018-02-06 21:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-06 21:17 Samir Jindel [this message]
2019-12-23 20:41 ` bug#30373: Support finalizers for functions created in dynamic modules Philipp Stephani
2019-12-26 0:04 ` bug#30373: [PATCH] Implement finalizers for module functions (Bug#30373) Philipp Stephani
2020-01-03 18:34 ` Philipp Stephani
2020-01-03 18:44 ` Eli Zaretskii
2020-01-03 18:53 ` Pip Cet
2020-01-03 20:13 ` Eli Zaretskii
2020-01-03 20:49 ` Pip Cet
2020-01-04 19:56 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAKjqF1Pd3iVFRjVBz1tdBrxycqhQjhevbhuZOois+yRFMggQ0w@mail.gmail.com \
--to=sjindel@google.com \
--cc=30373@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.