[Top][All Lists]

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

Re: Contributing LLVM.org patches to gud.el

From: Eli Zaretskii
Subject: Re: Contributing LLVM.org patches to gud.el
Date: Mon, 09 Feb 2015 18:08:05 +0200

> From: David Kastrup <address@hidden>
> Date: Mon, 09 Feb 2015 12:21:13 +0100
> Cc: address@hidden, address@hidden
> A generic dynamic library loading facility to Emacs has been in
> discussion and vetoed for decades.  Somewhat amusingly, the only
> working run-time dynamic library loading that I know of in Emacs is
> the loading of image libraries (free ones, of course) under Windows.

This is very inaccurate, and might lead Ricard, who doesn't know the
details, to very wrong conclusions.  So I must put the record

What we do have is _delayed_linking_ of shared libraries against which
Emacs was compiled at build time.  We provide a facility that performs
this delayed linking when the Lisp primitives that invoke functions
from the respective library are first called.  But the interface to
those functions, including their calling sequences and all the
involved data types, are known to the C compiler at the time the
corresponding C source file is compiled as part of building Emacs.

Moreover, use of these libraries from Emacs is possibly only through
specific primitives that were coded in advance and compiled into the
Emacs binary at build time.  Lisp programs cannot invoke any
functionality from these libraries _except_ what the above-mentioned
primitives provide.

IOW, the functionality this provides is exactly identical to Emacs
being statically linked to these libraries, except that the actual
linking is delayed until first use (or indefinitely, if there's no
use at all).

The reason we provide this on Windows is to allow users to install a
pre-compiled binary of Emacs and use it without installing the
optional libraries (such as image libraries or GnuTLS), if the user
doesn't need the extra functionality.  If we didn't provide this
feature, Emacs would refuse to start without all of the libraries
being present (unlike on Posix platforms, where it will run as long as
the functions from those libraries are not called).

By contrast, the "generic dynamic library loading" facility that is
missing, both on Posix platforms and on MS-Windows, is much more
flexible and allows the following features that are not currently
available in Emacs:

  . Two-way conversion between Lisp data types and arbitrary data
    structures, including pointers, in C, C++, and other languages

  . Loading libraries not known to Emacs at build time, for which no
    specialized primitives were coded as part of Emacs itself

  . Unloading of libraries no longer needed

  . Calling any exported library function from Lisp, without any need
    to write a C-level primitive

This is an entirely different level of using dynamic object loading,
and should never be even compared with the delayed linking of shared
libraries we have now.

reply via email to

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