all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* MPS: Problem with dynamic modules
@ 2024-05-19 13:01 Gerd Möllmann
  2024-05-19 13:21 ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Gerd Möllmann @ 2024-05-19 13:01 UTC (permalink / raw)
  To: Eli Zaretskii, Helmut Eller; +Cc: Emacs Devel

I think I've found a problem with modules, which I currently don't have
a plan how to fix it or work around it.

Example: vterm.

Its emacs_module_init uses module_make_global_ref to get handles to
functions in Emacs that it can call, among other things. One example

  emacs_value Fapply;

  int emacs_module_init(struct emacs_runtime *ert) {
    emacs_env *env = ert->get_environment(ert);
  {
    Fapply = env->make_global_ref(env, env->intern(env, "apply"));
  }

Note that Fapply here is a variable in the shared lib for vterm.

module_make_global_ref creates a module_global_reference in Emacs, say
R, a pseudo-vector, and remembers it in a global hash table. Its return
value is &R->value,

As a pseudo-vector, R moves, and &R->value changes when it does. And so,
Fapply in the vterm modules becomes invalid.



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

end of thread, other threads:[~2024-05-21 11:49 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-19 13:01 MPS: Problem with dynamic modules Gerd Möllmann
2024-05-19 13:21 ` Eli Zaretskii
2024-05-19 13:58   ` Gerd Möllmann
2024-05-19 15:37     ` Eli Zaretskii
2024-05-19 16:17       ` Gerd Möllmann
2024-05-19 16:28         ` Eli Zaretskii
2024-05-19 16:47           ` Gerd Möllmann
2024-05-20  5:35             ` Gerd Möllmann
2024-05-20 11:50               ` Eli Zaretskii
2024-05-20 12:07                 ` Gerd Möllmann
2024-05-20 13:06                   ` Eli Zaretskii
2024-05-20 13:23                     ` Gerd Möllmann
2024-05-20 13:50                       ` Eli Zaretskii
2024-05-21  7:56                         ` Andrea Corallo
2024-05-21  8:25                           ` Gerd Möllmann
2024-05-21 10:26                             ` Andrea Corallo
2024-05-21 11:49                               ` Gerd Möllmann

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.