all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, Helmut Eller <eller.helmut@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: MPS: Problem with dynamic modules
Date: Sun, 19 May 2024 15:01:35 +0200	[thread overview]
Message-ID: <m2seyec5w0.fsf@pro2.fritz.box> (raw)

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	other threads:[~2024-05-19 13:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-19 13:01 Gerd Möllmann [this message]
2024-05-19 13:21 ` MPS: Problem with dynamic modules 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

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=m2seyec5w0.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@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.