36.1. Adding a built-in function
Prev Chapter 36. Extending CLISP Core Next

36.1. Adding a built-in function

In the rare cases when you really need to modify CLISP internals and add a truly built-in function, you should read the CLISP sources for inspiration and enlightenment, choose a file where your brand-new built-in function should go to, and then ...

  • add the LISPFUN form and the implementation there
  • add the LISPFUN header to file subr.d
  • declare the function name in file constsym.d in the appropriate package (probably "EXT", if there is no specific package)
  • if your function accepts keyword arguments, then an appropriate pair of forms must be added to subrkw.d and you must make sure that the keyword symbols are declared in constsym.d;
  • see the example in Section 32.2.7.1, "Modprep" for argument passing and returning values
  • export your function name from the appropriate package in file init.lisp
  • when you are done, you should run make check-sources in your build directory: this will check that the definitions (source files) and the declarations (subr.d, subrkw.d and fsubr.d) are in sync.

Warning

Be very careful with the GC-unsafe functions! Always remember about GC-safety!

These instructions are intentionally terse - you are encouraged to use modules and/or "FFI" instead of adding built-ins directly.


These notes document CLISP version 2.49Last modified: 2010年07月07日




Chapter 36. Extending CLISP Core Home 36.2. Adding a built-in variable

AltStyle によって変換されたページ (->オリジナル) /