home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.emacs
- Path: sparky!uunet!ukma!darwin.sura.net!ra!ra.nrl.navy.mil!hoffman
- From: hoffman@cmf.nrl.navy.mil (Eric Hoffman)
- Subject: Adding C source to 18.59
- Message-ID: <HOFFMAN.93Jan28193429@tesuji.cmf.nrl.navy.mil>
- Sender: usenet@ra.nrl.navy.mil
- Organization: Connection Machine Facility, NRL
- Date: Fri, 29 Jan 1993 00:34:29 GMT
- Lines: 34
-
-
- I've been having difficulty adding C code to emacs (18.59). Any attempt
- to use a function that I have written, even if it is exactly the same
- as an emacs internal, results in a segv and trashing of the stack
- if I try to execute it. I am unable to use gdb because of the
- stack-trashing feature, and I suspect that it has more to do with
- the loading and dumping of the executable image, rather than
- the function that I copied verbatim from data.c.
-
- Is there a special procedure required to link new C into emacs? Is
- there a programming guide which explains extending emacs from the
- C side?
-
- What follows is my attempt to re-implement "int-to-string":
-
- #include "lisp.h"
-
- DEFUN ("bar", Fbar, Sbar, 1, 1, 0,"test")(obj)
- register Lisp_Object obj;
- {
- char buffer[20];
-
- CHECK_NUMBER (obj, 0);
- sprintf (buffer, "%d", XINT (obj));
- return build_string (buffer);
- }
-
- syms_of_bar ()
- {
- defsubr (&Sbar);
- }
-
-
-
-