unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30373: Support finalizers for functions created in dynamic modules
@ 2018-02-06 21:17 Samir Jindel
  2019-12-23 20:41 ` Philipp Stephani
  0 siblings, 1 reply; 9+ messages in thread
From: Samir Jindel @ 2018-02-06 21:17 UTC (permalink / raw)
  To: 30373

[-- 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 --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-04 19:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-06 21:17 bug#30373: Support finalizers for functions created in dynamic modules Samir Jindel
2019-12-23 20:41 ` 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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).