help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Wrapping an Emacs dynamic module in a package


From: Joris Vankerschaver
Subject: Re: Wrapping an Emacs dynamic module in a package
Date: Tue, 18 Oct 2016 08:31:59 +0100

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 <address@hidden>
> To: address@hidden
> Subject: Re: Wrapping an Emacs dynamic module in a package
> Message-ID: <address@hidden>
> 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 <args>))
>
> 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.
>
>


reply via email to

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