From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Nicolas Martyanoff Newsgroups: gmane.emacs.devel Subject: Re: Dynamic module building and reloading Date: Tue, 13 Jun 2023 19:10:25 +0200 Message-ID: <2E2FE4DB-0DBC-47F5-B0BB-6D8010826159@n16f.net> References: <834jnbwbcb.fsf@gnu.org> Mime-Version: 1.0 (1.0) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3994"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 13 19:10:53 2023 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 1q97Xh-0000qQ-EH for ged-emacs-devel@m.gmane-mx.org; Tue, 13 Jun 2023 19:10:53 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q97XV-00082K-Tr; Tue, 13 Jun 2023 13:10:41 -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 1q97XU-00082A-C2 for emacs-devel@gnu.org; Tue, 13 Jun 2023 13:10:40 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q97XS-0002xT-BL for emacs-devel@gnu.org; Tue, 13 Jun 2023 13:10:40 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-30fbac9639fso2862459f8f.1 for ; Tue, 13 Jun 2023 10:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=n16f-net.20221208.gappssmtp.com; s=20221208; t=1686676236; x=1689268236; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=Sm7BlI2hMwDMKrPRp8DTVcXuCZGYq5sdkk2CgEzt2ns=; b=Hg4fhLETyCWcWbaoqcYLusE+hZwoJN5geFPcMkJOe23H/yPmqzpappPsEEwDicNYnX gH9RfkmnxmBlOImXCkJdaD3xbE5Ijx7x0QVKIDYJKDvbcHeVJopJPb2CJy27oLVNae+V jhsr42/ksq0XqVvV2CXBBg3kd0skZEeE/ZYGyzWpp793yFHnDKF51LqdXITOxbLxhQNR sGCYaL80Qqw/H1Lqhk3ySeD7mZvHS8eNv1fVPG4Zl+bgehd5efRlXEntzIbuPhCbjJSu mUUZPy0vjqcT6swd5H5ZtV+lcS316r2cFZJOdDATKdVZkL6m1xT5n48Q7c5YrrRH1NP2 86Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686676236; x=1689268236; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sm7BlI2hMwDMKrPRp8DTVcXuCZGYq5sdkk2CgEzt2ns=; b=PvGpgt27W2X3Ka7VyOEUw1g7SKPHwz+8N+UuP2r97aS1KA7Yjoj39/mZ3rqVw51Ika 1j2p2zBQqx3cfY/nc2u9dR2fAX9hTUtkEpJMSBV1ZGtHoKiHwvkF7ZwVewgE/huT5BZR vgiYHdsP/At81T0HmvFQWMXTTqb/1ezqYIB6AlHpPq06c22GP6A0ActwN3/MDygF/OYb fzrccPJKhjgGa83aLv2ts4LwJnTxfYXlXUGlBmXLcDZuG+uXfKnNBDpeEJqsa8x3SDAE EcAPcWs8fR3WVm5/4/o9kbNGpnfxS4SiUJm5n0eHjgHdbTWGQKDZrwD0i1EHLxmI0Zzg t9IA== X-Gm-Message-State: AC+VfDxwscpeefNvpVa26hFl4CuCUXpozhZ1f3/r8MLGWIqRgaSQ0ajE zhXfgdTyAfr5IOMOunJlaGI+LJ1LKdFcYCiCEaOKmw== X-Google-Smtp-Source: ACHHUZ62FLcgqD7rvReAW/Sx9qPKWYpjfV8ujl1L7IpIoEljAyHg9Q5sZ5EHCfHJrczjJW49Ty8VqA== X-Received: by 2002:a5d:5590:0:b0:30f:bf2e:4b9a with SMTP id i16-20020a5d5590000000b0030fbf2e4b9amr6045630wrv.31.1686676236038; Tue, 13 Jun 2023 10:10:36 -0700 (PDT) Original-Received: from smtpclient.apple (2a01cb040009430028edfb91f89435d8.ipv6.abo.wanadoo.fr. [2a01:cb04:9:4300:28ed:fb91:f894:35d8]) by smtp.gmail.com with ESMTPSA id j29-20020a5d6e5d000000b0030fc280102bsm6169256wrz.90.2023.06.13.10.10.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jun 2023 10:10:35 -0700 (PDT) In-Reply-To: <834jnbwbcb.fsf@gnu.org> X-Mailer: iPhone Mail (20D67) Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=nicolas@n16f.net; helo=mail-wr1-x431.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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:306785 Archived-At: Got it, thank you for responding this quickly.=20 Are there technical limitations against reloading or is this just a case of =E2= =80=9Cif you need it send a patch=E2=80=9D? I know that some platforms may h= ave issues with it; but I use foreign library reloading in Common Lisp on Li= nux all the time, and it also works en BSD. Nicolas Martyanoff https://www.n16f.net nicolas@n16f.net > On 13 Jun 2023, at 18:55, Eli Zaretskii wrote: >=20 > =EF=BB=BF >>=20 >> From: Nicolas Martyanoff >> Date: Tue, 13 Jun 2023 18:11:47 +0200 >>=20 >> 1. There does not seem to be any builtin utilities to deal with >> the process of building and loading shared library. I ended up writing a >> couple elisp functions to find the location of the C file, spawn cc, >> load the shared library=E2=80=A6 Is this the expected method? In this sta= te, it >> would seem that every Emacs packages using dynamic modules has to write >> its own build/load code. >=20 > The expected method of building a shared library is the same as you'd > use for building any other shared library out there. The Emacs > modules aren't special in any way, and the details of their build > procedures depend on what code you are compiling in, which other > libraries you need to link against, etc. There's no way an Emacs > command could cover all that. However, if you write a Makefile to > compile and link the module, you can use "M-x compile" to run the Make > utility to build your module. >=20 >> 2. It seems that once a dynamic module has been loaded, it cannot be >> reloaded after the shared library has been rebuilt. A Google search >> seems to confirm it. Is there a workaround? If I pursue my little >> project, I'll have to write quite a lot of C code in the dynamic module; >> I *really* do not want to restart Emacs to test every single >> modification. >=20 > We don't have a facility to unload a module, no. The usual way of > testing your development code is to start a new scratch session (in > addition to your production Emacs session) each time you recompile a > module.