All Manuals > LispWorks COM/Automation User Guide and Reference Manual > 2 COM Reference Entries




Converts an IDL file into Lisp FLI definitions.




midl file &key package depth mapping-options output-file load import-search-path



A pathname designator giving the name of an IDL file.


The package in which definitions are created. Defaults to the current package.


How many levels of IDL import statement to convert to Lisp. This defaults to 0, which means only convert definitions for the IDL file itself. Imported files should be converted and loaded before the importing file. Some of the standard files are preloaded, so should not be loaded again (see Standard IDL files).


Allows options to be passed controlling the conversion of individual definitions.


If this is nil (the default), the IDL file is compiled in-memory. Otherwise a Lisp fasl is produced so the definitions can be reloaded without requiring recompilation. If output-file is t then the fasl is named after the IDL file, otherwise output-file is used as a pathname designator to specify the name of the fasl file.


If this is true (the default) then any fasl produced is loaded after being compiled. Otherwise, the fasl must be loaded explicitly with load. This argument has no effect if output-file is nil.


Specifies where to look for files referenced by import statements in the IDL. The default value, which is :default, causes a search in the same directory as file . Otherwise the value should be a list of pathname designators specifying directories to search. After searching using the value of import-search-path, midl looks in any directory in the list that was set by midl-set-import-paths or the INCLUDE environment variable, and then the directories that are returned by midl-default-import-paths.


This function is used to convert an IDL file into Lisp FLI definitions, which is necessary before the types in the file can be used from the Lisp COM API. See The mapping from COM names to Lisp symbols for the details on how these FLI definitions are named.

Import paths

When the file that midl processes contains import statements (which is the normal case, because at least "unknwn.idl" is needed), midl looks for the imported file in these directories:

  1. The directory in the import-search-path argument, or if it is :default in the directory of the file argument.
  2. Note: you can pass import-search-path as nil to prevent searching in the directory of file. In many cases that is the more useful behavior.

  3. The directories in the list that was set by midl-set-import-paths, or if it is :default the directories in the INCLUDE environment variable.
  4. The directories in the list that is returned by midl-default-import-paths.

The recommended way of getting the standard files to import is to install Windows SDK from If you install it in the default place, midl-default-import-paths should be able to find the right paths. Thus normally installing the Windows SDK is all you need to do to get the standard midl files.


midl requires that types like IDispatch are declared before they are used.


To compile myfile.idl into memory:

(midl "myfile.idl")

To compile myfile.idl to myfile.ofasl:

(midl "myfile.idl" :output-file t :load nil)

To compile myfile.idl to myfile.ofasl and load it:

(midl "myfile.idl" :output-file t)
See also


LispWorks COM/Automation User Guide and Reference Manual - 23 Mar 2017