/* example module compilation: $ gcc -Wall -Iemacs/src -Iemacs/lib -fPIC -c fmod.c $ gcc -shared -o fmod.so fmod.o loading: $ ./emacs -Q --batch --eval '(load-module "../../fmod.so")' hello world */ #include #include #include #include /* emacs checks for this symbol before running the module */ int plugin_is_GPL_compatible; /* XXX: DEFUN doesn't work yet... :( */ #if 0 /* define a new lisp function */ DEFUN ("fmod", Ffmod, Sfmod, 2, 2, 0, doc: /* Returns the floating-point remainder of NUMER/DENOM */) (Lisp_Object numer, Lisp_Object denom) { return make_float (fmod (extract_float (numer), extract_float (denom))); } #endif /* entry point of the module */ void init () { // defsubr (&Sfmod); printf ("hello world\n"); }