🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.emacs
Article #3581

Adding C source to 18.59

#3581
From: Eric Hoffman
Date: Fri, 29 Jan 1993 00:34
31 lines
1332 bytes
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);
  }
Technical Details
Message-ID: <HOFFMAN.93Jan28193429@tesuji.cmf.nrl.navy.mil>
Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!ra!ra.nrl.navy.mil!hoffman

Show Full Headers
Complete Article Headers
Newsgroups: comp.emacs
Path: arc1-ca.pugleaf.net!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