From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: MPS: Problem with dynamic modules Date: Sun, 19 May 2024 15:01:35 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33109"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel To: Eli Zaretskii , Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 19 15:02:37 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s8gBQ-0008Q0-Uo for ged-emacs-devel@m.gmane-mx.org; Sun, 19 May 2024 15:02:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8gAY-00037H-Fx; Sun, 19 May 2024 09:01:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8gAX-00036v-0G for emacs-devel@gnu.org; Sun, 19 May 2024 09:01:41 -0400 Original-Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s8gAV-0008Lw-Gs; Sun, 19 May 2024 09:01:40 -0400 Original-Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-571ba432477so7158909a12.1; Sun, 19 May 2024 06:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716123697; x=1716728497; darn=gnu.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=sscBDWu06oNNImgKfA4zD9CXBbIZH6FIs1akCb85w90=; b=E6F7cUspgdic9tN0QbE8j3YcZuOa09qt9SomHZ3Tn7+svUu2v5R/wmIG8qO12V/0Pk at2tzgZPkhSPv0VAzSt+0wMi1hY2vFwxj0k/MwTzKIJVCEWytvmNpDy5mozzdBAKA53H v39eQu04D40iP7OBnyr7PuFQMazwfQpgRCDunGzQUaCChURVonBVpDtDifoAFH5u86Qb fBoBjZuQc+pDpj0UenhMsQl7kAcTJWgMSZWNYjF1q/lGO5Lzlef4Ud3zj4d6xTgIJYm3 sz4yYGAlotV3Qn77FAvEAKEyfDB6BBw1B6ZITuuo+ujzYnMd6JUjaR1m408h6wYTd2XX zjSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716123697; x=1716728497; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=sscBDWu06oNNImgKfA4zD9CXBbIZH6FIs1akCb85w90=; b=neuiF7S+nNBQTlrz+Zf85/Sb7VLnOfsjR5WxvGUeezE2j6oF/YYnXyYDmU3QPnRNXg svqDvcM62JuW1X4wrsfE7psKCPvcEzfPmthpWLtJ0mXbwUHYWfdDeC58EnCYU82UHJM+ 455vjc1bNxrJre5mu1I67ZEHCaKb0MrAukPLRQA0BgeolSMvqaqqZ51PsDYDrPS83WzZ D1ouWtE58yF9ZPJoaLX9qLyqY0Qwk5vB48T8MXUTAkEdwrAZlIYvYJd5DJrUy7QgjZsZ iC6wr7BxbDLYyhTpgwbyMnuDSm+juCVKT2tdrx/jaGO7hxo1tbZcrHPYgaAi8F4WrXU4 Ls4g== X-Gm-Message-State: AOJu0Yw5MOMiHO5fjLoSS8V1se7ihyRVvBhiPeV02AMdS9gD7lqSJpuE pGttoCadZc4AlCaoPvUWr2XyydMBNGKuvwojEdLv1m57I0nNzW1g6y8Kqg== X-Google-Smtp-Source: AGHT+IGSsmxXxamclQcDKz5YDxT0kY3R8+YsXbq2PNhNwRwUsilwBRRZy4CbvdZ6M1H8C3+C9IIS0w== X-Received: by 2002:a50:9f06:0:b0:570:db4:e5cd with SMTP id 4fb4d7f45d1cf-5734d67eb96mr19119710a12.34.1716123696789; Sun, 19 May 2024 06:01:36 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36d54.dip0.t-ipconnect.de. [217.227.109.84]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574f73a7ee0sm6077071a12.4.2024.05.19.06.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 May 2024 06:01:36 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319373 Archived-At: 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.