Search code examples
visual-c++dllimportprecompiled

How can I connect an already existing/compiled .dll to a new project in Visual Studio?


I have a previously compiled dll file. I've lost the source code unfortunately. But I know the functions, header names and namespaces on it.

Is it possible to add this dll to a new project in VS? If so what code should I use? (not sure how to use dllimport in this case)

Both the DLL and the new project are on C++ .net 2.0. I'm using VS2008


Solution

  • You should just have to add a reference to your project that points to the dll. Right click the project-> go down to add -> reference. Or Expand the Project and right click the references node and click add. enter image description here

    This opens a dialog with 4 items to the left. click on browse then click the browse button at the bottom. Find your dll and click add and then Ok to close the dialog. enter image description here After that use it as you would any other dll.