emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MPS: Problem with dynamic modules


From: Gerd Möllmann
Subject: MPS: Problem with dynamic modules
Date: Sun, 19 May 2024 15:01:35 +0200

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]