Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking dll in Visual Studio

How can I add a .dll in Visual Studio 2010? I just cannot find the option there.

like image 534
smallB Avatar asked Oct 21 '11 06:10

smallB


People also ask

How do I link a DLL in Visual Studio?

To create a DLL project in Visual Studio 2017On the menu bar, choose File > New > Project to open the New Project dialog box. In the left pane of the New Project dialog box, select Installed > Visual C++ > Windows Desktop. In the center pane, select Dynamic-Link Library (DLL).

How do I add a reference to a DLL in Visual Studio C++?

Using Visual C++ .In Solution Explorer, select the project. On the Project menu, click Add References. In Visual C++, click References on the Project menu, and then click Add New Reference. In the Add References dialog box, click the tab that corresponds with the category that you want to add a reference to.


1 Answers

On Windows you do not link with a .dll file directly – you must use the accompanying .lib file instead. To do that go to Project -> Properties -> Configuration Properties -> Linker -> Additional Dependencies and add path to your .lib as a next line.

You also must make sure that the .dll file is either in the directory contained by the %PATH% environment variable or that its copy is in Output Directory (by default, this is Debug\Release under your project's folder).

If you don't have access to the .lib file, one alternative is to load the .dll manually during runtime using WINAPI functions such as LoadLibrary and GetProcAddress.

like image 137
gwiazdorrr Avatar answered Sep 29 '22 03:09

gwiazdorrr