All Manuals > LispWorks Foreign Language Interface User Guide and Reference Manual > 1 Introduction to the FLI > 1.1 An example of interfacing to a foreign function

NextPrevUpTopContentsIndex

1.1.2 Loading foreign code

Once an interface has been created, the object code defining those functions (and indeed any variables) must be made available to LispWorks.

LispWorks for Windows can load Windows Dynamic Link Libraries ( .DLL files).

LispWorks for Linux and LispWorks for FreeBSD can load shared libraries (typically .so files).

LispWorks for Macintosh can load Mach-O dynamically-linked shared libraries (typically .dylib files).

LispWorks for UNIX can either load object files (usually suffixed with " .o ") directly into the Lisp image, extract any required object files from the available archive libraries (usually suffixed with " .a "), or load in shared libraries (usually suffixed with " .so ").

Throughout this manual we shall refer to these dynamic libraries as DLLs.

On all platforms the function register-module is the main LispWorks interface to DLL files. It is used to specify which DLLs are looked up when searching for foreign symbols. Here are example forms to register a connection to a DLL.

On Windows:

(fli:register-module "MYDLL.DLL")

On Linux:

(fli:register-module "mylib.so")

On Macintosh:

(fli:register-module "mylib.dylib")

Note: LispWorks for UNIX also provides the loader function link-load:read-foreign-modules familiar to users of LispWorks 4.3 and earlier. However, this is now deprecated in favor of register-module.

Note: It is also possible to embed a DLL in the Lisp image. See Incorporating a foreign module into a LispWorks image.


LispWorks Foreign Language Interface User Guide and Reference Manual - 7 Dec 2011

NextPrevUpTopContentsIndex