Next Prev Up Top Contents Index

register-module

Function
Summary

Informs LispWorks of the presence of a DLL.

Signature

register-module name &key connection-style real-name => name

Arguments

name

A symbol or string specifying the Lisp name the module will be registered under. It is used for explicit look up from the :module keyword of functions such as define-foreign-function . If real-name is not specified then name is taken to be the actual name of the module to connect to.

connection-style

An option specifying either :automatic or :manual connection to the module.

:automatic automatically connects to a DLL in order to resolve currently undefined foreign symbols.

:manual only connects to the DLL if the symbol to resolve is explicitly marked as coming from this module via the :module keyword of functions such as define-foreign-function .

real-name

Overrides the name for identifying the actual DLL to connect to.

Values

name

The name argument.

Description

The function register-module explicitly informs LispWorks of the presence of a DLL. Functions such as make-pointer and define-foreign-function have a module keyword which can be used to specify which module the function refers to.

The main use of modules is to overcome ambiguities that can arise when two different DLLs have functions with the same name.

The naming convention for the module name can contain the full pathname for the DLL. For example, a pathname such as

#p"C:/MYPRODUCT/LIBS/MYLIBRARY.DLL"

is specified as

"C:\\MYPRODUCT\\LIBS\\MYLIBRARY.DLL"

If the module is declared without an extension, " .DLL " is automatically appended to the name. To declare a name without an extension it must end with the period character (" . ").

If a full pathname is not specified for the module, then it is searched for in the following directories (in the given order):

  1. The directory of the executable.
  2. The current directory.
  3. The Windows system directory (as specified by GetSystemDirectory ). For Windows NT the 16-bit system directory ( SYSTEM ) is also searched.
  4. The Windows directory (as specified by GetWindowsDirectory )
  5. Directories specified by the PATH variable.
Example

In the following example the gdi32 DLL is registered, and then a foreign function called set-cur is defined to explicitly reference the SetCursorPos function in the gdi32 DLL.

(fli:register-module :gdi-dll :real-name "gdi32")
(fli:define-foreign-function (set-cur "SetCursorPos")
  ((x :long)
   (x :long))
   :module :gdi-dll)
See Also

define-foreign-function

make-pointer


LispWorks Foreign Language Interface User Guide and Reference Manual - 14 Dec 2001

Next Prev Up Top Contents Index