Using .dll in Visual Studio 2010 C++

39,465

C++ is not C#. You don't include .dlls in C++ applications by adding "references". Unless it's C++/CLI, but that's not C++.

In C++, you would go, in the project configuration, to Linker->Input->Additional Dependencies. There, you would list the library name plus path to the .lib in question.

Normally, when you build a Windows C/C++ DLL, you also get a .lib. This is an import library; users of the library include (as stated above) that .lib in order to access the DLL. They generally do not load the .dll directly (though there are ways to do that).

Share:
39,465
sdasdadas
Author by

sdasdadas

Updated on July 27, 2020

Comments

  • sdasdadas
    sdasdadas almost 4 years

    I have a problem. I place my .DLL and .LIB file in the same directory as my project, go to Properties -> Common Properties -> Framework and References -> Add New Reference. But the list comes up empty.

    Is there something else I should be doing?

  • sdasdadas
    sdasdadas over 12 years
    Why is the MSDN documentation so vastly different?
  • wilx
    wilx over 12 years
    VS 2010 has made the references work even for pure C++ projects. Though I do not know why is that it does not work for you.
  • Nicol Bolas
    Nicol Bolas over 12 years
    I'm still on VC2008, so there's that.
  • user1703401
    user1703401 over 12 years
    It is the same in both, it lists other projects. The OP has only one project in his solution, that's why the list is empty.
  • fIwJlxSzApHEZIl
    fIwJlxSzApHEZIl almost 12 years
    So how do you go about linking an external .DLL file then when there is no visual studio solution for the .DLL file in question?