4.1 The Foreign Function Interface

4.1.3 Loading foreign language files

The following functions allow you to load foreign functions and symbols that have been defined in the Foreign Function Interface:


The functionload-foreign-files loads foreign language compiled files into the running Lisp environment.load-foreign-libraries loads selected functions from foreign language library files. Files have.o extensions, and libraries have.a extensions by default.

The functionunintern-foreign-symbol makes a foreign symbol inaccessible so that you can reuse its name in newly loaded foreign object code. Thus, you can load a file into Lisp, edit and recompile the file, and then reload a new version of the file into the same image. The functionforeign-undefined-symbol-names lists the foreign symbols that are not associated with foreign code.

Suppose you want to suppress a redefinition of a foreign symbol named"example".(unintern-foreign-symbol "example") disassociates the symbol from the name"example" so that loading object files does change not the original foreign symbol.

Normally, all foreign symbols defined in the object file being loaded supersede any definitions that previously existed, just as loading a Lisp file with a definition of a function namedformat causes the Common Lisp functionformat to be redefined. This ability to dynamically redefine foreign functions carries with it the same benefits and risks that it does for Lisp functions. Redefining a system-level foreign symbol, such as the foreign symbol named"write", is as dangerous as redefining a system-level Lisp function.

Some foreign symbols have special definitions that cannot be changed without violating the integrity of the Lisp system. The foreign symbols named"start","sbrk", and"main" are among those symbols that should never be redefined. - Restrictions when using the foreign loader

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker