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

midl Function

Summary

Converts an IDL file into Lisp FLI definitions.

Package

com

Signature

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

Arguments
file
A pathname designator.
package
A package designator.
depth
A non-negative integer.
mapping-options
An alist.
output-file
nil, t or a pathname designator.
load
A generalized boolean.
import-search-path
A list of pathname designators or :default.
Description

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

package specifies the package in which definitions are created. It defaults to the current package.

depth specifies 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 1.2.3 Standard IDL files).

mapping-options allows options to be passed controlling the conversion of individual definitions.

If output-file 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 load 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.

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. A directory in import-search-path, or if it is :default in the directory of file.

    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.

  2. 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.
  3. 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 microsoft.com. 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.

Notes

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

Examples

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

:midl-file


COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:38