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

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

Can elisp call C functions without recompilation of emacs?


From: Fren Zeee
Subject: Can elisp call C functions without recompilation of emacs?
Date: Wed, 08 Dec 2010 15:54:06 -0000
User-agent: G2/1.0

In 1996, Stephen Eglin asked the following question which was never
answered but is of interest to people in C , Lisp and users of Emacs :

http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/a89c2d3ddd89768d/a2368ff6f5ea1b7b?q=%22Writing+Emacs+Primitives%22

Newsgroups: comp.emacs, gnu.emacs.help
From: address@hidden (Stephen Eglen)
Date: 1996/04/10
Subject: Can elisp call C functions without recompilation of emacs?
Reply to author | Forward | Print | Individual message | Show original
| Report this message | Find messages by this author
Can elisp call functions written in C without recompilation of emacs?

I think what I am asking is not possible, but here goes anyway...

Here at Sussex we have an environment called POP-11, which is a lisp
style interactive AI programming environment.  One of its main
features is that you can call C functions from POP-11 after the shared
object files containing the C functions have been loaded into POP-11.
This can be done interactively, and does not require either POP-11 to
be recompiled or for the C functions to be compiled with any special
options.  So for example, if I write a function called add(x,y) in C,
and then compile it into a shared object, I can then call this C
function from POP-11 once I have loaded in the object file storing the
add function.  Of course,one of the restrictions made on the POP:C
interface is that I think the arguments to a c function must be ints,
floats, doubles and chars, rather than abstract c data types.

This is a very useful facility, especially when debugging c functions,
since you can write the test functions in POP-11, which is an
interactive language, and so only the C functions need compiling, and
not the test functions.   (I'm not sure exactly how the mechanism
works
in POP-11, but I think it uses some form of incremental compiler?)

My question therefore is does emacs offer this facility of calling c
functions from elisp?  I notice in the elisp info files (Writing Emacs
Primitives) that of course some emacs primitives are written in c, but
am I right in thinking that once the c function has been written, the
whole of emacs needs recompiling?  If this is the case, then I guess
the compile time of emacs would be a big overhead, and probably not
worth it.  Also, it looks like the c functions have to be written
especially with elisp in mind (eg use of the DEFUN macros.)

I only have access to emacs 19.27 at the moment, but if it works for
other versions, I would be interested in hearing about them.

Thanks in advance, Stephen Eglen.
--
Stephen Eglen, DPhil Student,
address@hidden
School of Cognitive and Computing Sciences,       Fax: +44-(0)1273
671320
University of Sussex,                           Phone: +44-
(0)1273-678524
Falmer,  BRIGHTON, BN1 9QH, UK http://www.cogs.susx.ac.uk/users/stephene/



reply via email to

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