Effective February 22, 2024, Google Groups will no longer support new Usenet content. Posting and subscribing will be disallowed, and new content from Usenet peers will not appear. Viewing and searching of historical data will still be supported as it is done today.

Can elisp call C functions without recompilation of emacs?

6 views
Skip to first unread message

Stephen Eglen

unread,
Apr 10, 1996, 10:00:00 AM4/10/96
to
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, step...@cogs.susx.ac.uk
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 all
Reply to author
Forward
0 new messages