36.1. Adding a built-in function
Prev | Chapter 36. Extending CLISP | 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`;
- 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.45 | Last modified: 2008-05-14

Enter your search termsSubmit search form
Webclisp.cons.orgclisp.podval.orgwww.lisp.org

Prev | Up | Next
Chapter 36. Extending CLISP | Home | 36.2. Adding a built-in variable