From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Joris Vankerschaver Newsgroups: gmane.emacs.help Subject: Re: Wrapping an Emacs dynamic module in a package Date: Tue, 18 Oct 2016 08:31:59 +0100 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1476775978 11502 195.159.176.226 (18 Oct 2016 07:32:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 18 Oct 2016 07:32:58 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 18 09:32:54 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bwOt6-0000dD-1U for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Oct 2016 09:32:40 +0200 Original-Received: from localhost ([::1]:39336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwOt6-0005cd-VW for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Oct 2016 03:32:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwOsW-0005cQ-2f for help-gnu-emacs@gnu.org; Tue, 18 Oct 2016 03:32:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwOsU-00067Z-Bo for help-gnu-emacs@gnu.org; Tue, 18 Oct 2016 03:32:03 -0400 Original-Received: from mail-lf0-x236.google.com ([2a00:1450:4010:c07::236]:33506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1bwOsT-00066X-UZ for help-gnu-emacs@gnu.org; Tue, 18 Oct 2016 03:32:02 -0400 Original-Received: by mail-lf0-x236.google.com with SMTP id x79so340422728lff.0 for ; Tue, 18 Oct 2016 00:32:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=NX1hEU1nIfsW1YLnzfPD0HROmxQBPm7JrTD2Uk/9ETI=; b=JmyG/LIGpi6CK4d+mqJuODwQ4JP7ztSW/SKu+xmopYBohmP+MiilVg5VtErKpXfVx2 FZcbomirpeRrzy5teNlmKJP3Gql/kRVrwfaMWnx+VKfJgC3zJMbBWIQ9km8eD7Cq6e9E mBPug57/eh3g1sl5rhmADigzOtvxuYllqTAon9RcLj63Qi/RpY56nuqHvW7jepxmqAuf eDXeOCErwQuvGosk7zrYJYTMy2xyw8Rd4LjxIsOHu7/yol5BnfmzBRfP+QHUnnf+ff38 F6/Mu1yT+fIe5H6A4m3id/Qx6lF1mNYFAhTtcE09dUVek9EgjhJFBukAkYlATSdfasJf 2tlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NX1hEU1nIfsW1YLnzfPD0HROmxQBPm7JrTD2Uk/9ETI=; b=Jh1iaKDTHmKxbCCXMp+yjmTx8MbFCy7WLvgzE2A9tbwxgeTs0PGM3wXJ4RJiI77x6i HKG7eVLnCYq4xG7Z3Q3Ym5nn8OY9rd9fBmCIU6PCtFouIFbu1lYiZl0DHJgcCtQ1T26q mzz+ywBu/v79orarwtLFll6Ef7/uJfHVEB14hsNoGpmf7g+2/Bw9arB5/i5I9mJvBm3b a0JXEubiUNXzRAJbNxLbwE9m5Y+UeS8tllqnMxhD1GBxlevOvDllPvzOxnad70aUTWny KeT9/uRC5X3juFkdFs/jiNgSc4VY8XVyj1mq4NZ9afGtMi79LjopBUH1RUCukhKYsfaP h0DA== X-Gm-Message-State: AA6/9RlVwo39KhgTl5tUb/eOM0S6WbkJu4bbKOL0uT2UGr8TgIoTIBYaagaY+9n5ix5oZLrjxIGEj0ocqSaHzQ== X-Received: by 10.28.63.199 with SMTP id m190mr10282895wma.96.1476775919710; Tue, 18 Oct 2016 00:31:59 -0700 (PDT) Original-Received: by 10.80.177.59 with HTTP; Tue, 18 Oct 2016 00:31:59 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::236 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111559 Archived-At: Hi Stefan, Thanks for your reply. I will create a bug report as you suggested, with the necessary info (clear description, backtrace, etc). For the record, I think I know what the issue is: update-directory-autoloads in autoload.el will look at get-load-suffixes to build a list of files that need autoloads. It removes .elc from the list of extensions to take into consideration when building this list, and I think that also removing .so will do trick. This at least allows my package to install cleanly (and be usable afterwards). You raise a point that I hadn't thought about: including the shared object file in my package will make it of course platform-dependent. Also, thanks for correcting me on my verbiage regarding _mymod.SO vs. _mymod.C. It's always good not to take things for granted. All the best, Joris > Date: Mon, 17 Oct 2016 09:27:16 -0400 > From: Stefan Monnier > To: help-gnu-emacs@gnu.org > Subject: Re: Wrapping an Emacs dynamic module in a package > Message-ID: > Content-Type: text/plain > > > 1) I wrote an emacs module _mymod.so, as well as wrappers mymod.el (with > > some local setup) and mymod-pkg.el (which only has a call to > > define-package). > > FWIW, I doubt you wrote _mymod.so. Most likely you wrote something like > _mymod.c and then you asked a C compiler and a linker turn that into > a _mycmd.so. > > Yes, it's a nitpick, but when you send your bug-report, please try to > use precise wording, because it's often surprisingly easy to introduce > major confusion otherwise. > > > In my messages buffer, I see that Emacs tries to generate autoloads for > the > > .so, and fails with the error indicated in the original email > ("_mymod.so:0:0: > > error: scan-error: (Containing expression ends prematurely 238020 > > 238021))"). > > In your bug-report, please show the corresponding backtrace. > > > 1) Should Emacs be able to generate autoloads for an .so? > > No. It shouldn't scan those files for autoloads. > > > 2) Does anybody have any experience with embedding an emacs module in an > > emacs package? Any best practices I should be aware of? > > You might very well be the first to try it out. > > Note, tho, that the ELPA format is a tarball containing .el files, > i.e. *source* files. Similarly, it should hold _mycmd.c rather than > _mycmd.so. Then again, package.el doesn't know how to turn that > _mycmd.c into _mycmd.so. You can probably work around that problem by > adding something like > > (eval-when-compile > (call-process "cc" nil nil nil )) > > in your mymod.el (so that when the .el file gets byte-compiled, it > triggers compilation and linking of the C module). > > But yes, including the .so *should* happen work (barring bugs) as long > as you're lucky enough to use the package on the right OS with the right > Emacs version, on the right architecture. > >