hardyz009
hardyz009

Reputation: 149

How to include DLL from another directory

I have made a dll by the name test.dll. I have the .lib file and the header file for the same.

I pasted the .lib file and a header file in program A and program B folder, but I want to have a common folder, where I can paste my test.dll, so that both A and B can use it.

I am using VS 2008. Language is C++

Upvotes: 2

Views: 3389

Answers (1)

Gwyn Evans
Gwyn Evans

Reputation: 1521

You need to add the common directory to your PATH, or start both A & B from the same directory (which would also contain the DLL).

See this MSDN article for details/options...

-- More --

By default, the system will look in the following locations...

  1. The directory from which the application loaded.
  2. The system directory.
  3. The 16-bit system directory.
  4. The Windows directory.
  5. The current directory.
  6. The directories that are listed in the PATH environment variable.

You can't change them programably, but you can get the result you want by adding the common folder location to your PATH environment variable before running the programs

Upvotes: 2

Related Questions