Linking Implicitly


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Linking Implicitly.

To implicitly link to a DLL, executables must obtain the following from the provider of the DLL:

  • A header file (.h file) containing the declarations of the exported functions and/or C++ classes. The classes, functions, and data should all have __declspec(dllimport), for more information, see dllexport, dllimport.

  • An import library (.LIB files) to link with. (The linker creates the import library when the DLL is built.)

  • The actual DLL (.dll file).

Executables using the DLL must include the header file containing the exported functions (or C++ classes) in each source file that contains calls to the exported functions. From a coding perspective, the function calls to the exported functions are just like any other function call.

To build the calling executable file, you must link with the import library. If you are using an external makefile, specify the file name of the import library where you list other object (.obj) files or libraries that you are linking with.

The operating system must be able to locate the DLL file when it loads the calling executable.

What do you want to do?

What do you want to know more about?

See Also

Linking an Executable to a DLL