# Use the Module Wizard to Generate Code (Windows)

This topic only applies to Windows.

To run the Intel® Fortran Module Wizard, select Tools > Intel Compiler > Intel® Fortran Module Wizard.

The module wizard displays a series of dialog boxes allowing you to select the COM or Automation object and provide additional information.

COM and automation objects are self-describing, using type information. An object's type information contains programming language independent descriptions of the object's interfaces. Type information can be obtained from the object's type library.

A type library is a collection of type information for any number of object classes, interfaces, and so on. You can store a type library in a file of its own (usually with an extension of .TLB) or it can be part of another file. For example, the type library that describes a DLL can be stored in the DLL itself.

After you start the module wizard, the COM tab of the dialog box displays the list of type libraries that are registered on your system. (There is also a .NET tab, which is explained in Using .NET Components.)

The list has three columns:

- The component name

- The component version number

- The path to the type library

You may select a single component from the list, or click the Browse for Type Library… button to find a type library on your system.

The dialog box also provides the Generate code that uses Automation interfaces option. If the option is not selected, the Wizard will generate code to use the COM interfaces of the component.

The documentation of the component should tell you whether the component implements COM interfaces, Automation interfaces, or dual interfaces. A dual interface supports both COM and Automation interfaces. For a component that supports dual interfaces, you can check the Generate code that uses Automation interfaces option, or leave it unchecked. The COM interfaces tend to be more efficient (better runtime performance).

ActiveX controls implement an Automation interface. When using an ActiveX control, check the Generate code that uses Automation interfaces option.

After you select a component from the list or by browsing using the Browse for Type Library… button, click Next>.

This dialog box lists the members that are defined in the type library. Click the Select All button to select all of the members of the type library, or select individual members from the list. The Wizard uses the selected members.

This dialog box also contains two options regarding the code to be generated by the Wizard:

- Select Generate DLLEXPORT statements if you plan to place the generated module in a DLL for use by other projects. The Wizard will generate the DLLEXPORT statements to make the routines in the module visible outside of the DLL.

- Check for exception return status (Automation only) is active if you checked the Generate code that uses Automation interfaces option in the first dialog box. Select this option if you want the Wizard to generate code to check the return status of each Automation method or property invocation, and to display a dialog box when an error is generated.

Change the module name if desired and select Finish.

## Use .NET Components

The .NET tab is available on the first dialog box. The module wizard cannot directly read the type information of a .NET component. However, the .NET Framework Tools (provided with Visual Studio*) contain the Type Library Exporter (Tlbexp.exe). The Type Library Exporter generates a COM type library that describes the types defined in a .NET component (also known as a common language runtime assembly).

Select the .NET tab to view the assemblies that are registered in your system’s Global Assembly Cache (GAC). The list contains the same three columns as the COM tab, as well as a Browse for Assembly button. Select a .NET component from the list, or use the Browse for Assembly button to select a .NET component on your system.

Press Next > to run the Type Library Exporter tool to create a type library from the .NET component. If the tool returns an error message, the message is displayed in a dialog box and the Wizard returns to its first dialog box. In this case, no Fortran module is generated. If the tool succeeds, the second Wizard dialog box is displayed with the members found in the type library. There are restrictions on the .NET components that can be used with the Type Library Exporter tool. For example, a common error message returned by Type Library Exporter tool is:

`You cannot use Tlbexp.exe to produce a type library from an assembly that was imported using the Type Library Importer (Tlbimp.exe). Instead, you should refer to the original type library that was imported with Tlbimp.exe.`

In this case, the .NET assembly was created from the information in a type library, and you must obtain the original type library from the assembly provider in order to use it with the Module Wizard.

See the .NET Framework Tools documentation for details.

The Wizard runs the Type Library Exporter tool with the /nologo/silent options. You can also run the tool to create a type library before running the Module Wizard if you prefer.

## Intel® Fortran Module Wizard Command Line Interface

The Intel® Fortran Module Wizard also has a command-line interface. The MODWIZ command has the following form:

    MODWIZ [options] typeinfo-name

For a list of MODWIZ command options and an explanation of typeinfo-name, type the following command in a Fortran command prompt (available from the Intel® Fortran Compiler program folder):

    MODWIZ /?

Parent topic: Use the Intel® Fortran Module Wizard (COM Client) (Windows)