### Compile and Link Your DLL in One Step

You can compile and link your source files in one step or in separate steps. The preferred method is to compile and link in one step.

When you use icc to compile and link your DLL:

- use the /Ge- compiler option to specify that you are building a DLL
- Set options to choose the runtime libraries you want to use.
  - Single-thread (/Gm-) or multithread (/Gm+) (single-thread is the default).
  - Statically linked (/Gd-) or dynamically linked (/Gd+) (statically linked is the default).

> The method of linking used for the runtime libraries is independent of the module type you create; you can statically link the runtime functions in a dynamic link library.

> All objects in a link must be compiled with the same settings of /Gm and /Gd.

- Specify on the command line all the DLL source, object and library files, followed by the module definition file, if used.
  If you use any of the Complex, Collection, or User Interface classes, you must specify the library names on the command line. You must also specify the /Tdp option.

By default, the name of the first source file (without the file name extension) is used as the name of the DLL. For example, to compile and link the files mydlla.c and mydllb.c, using the mydll.def module definition file, use the command:

       icc /Ge- mydlla.c mydllb.c mydll.def

The resulting DLL will be called mydlla.dll.

Alternatively, you can specifically name the output DLL, for example:

>        icc /Ge- mydlla.c mydllb.c mydll.def /Femyname.dll

If your DLL contains C++ code that uses templates, there are additional considerations.

Create a DLL - An Overview
Compile and Link Your DLL in Separate Steps