Perhaps it would help to understand how things work using the traditional way before managed code and such. It might help to read the documentation in the Platrorm SDK.
Note that most of the Platform SDK are functions in DLLs. To call a function in other DLLs, a header is often used that prototypes the function and imports it. Then a library (.lib file) is used by the linker to obtain the information the linker needs. The compiler and the linker don't need to know anything about the DLL; the library file provides everything needed. The DLL, including the actual location, is only needed during execution. When linking, the linker needs two peices of information that is usually provided separately; the name of the library and the directory it is in. That information can be provided in various ways but I won't get into that; that is explained very well elsewhere.