Setup another path to load a dll

Flaviu_ 1,091 Reputation points
2022-11-21T15:44:18.883+00:00

For a VC++ project, is there a way to setup a path to load a dll from another path than the current project it is ?

For instance, I have a project, Test, which generate Test.exe. The current path is C:\Project\Test\Debug\Test.exe

The question is, how can I setup in my current project, Test, another path in such a way, to load (at rutime of course) another dll, let say, Customer.dll, from C:\Project\Customer\Debug\Customer.dll ?

Developer technologies | C++
Developer technologies | C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
0 comments No comments
{count} votes

Answer accepted by question author
  1. RLWA32 51,536 Reputation points
    2022-11-21T16:16:05.82+00:00

    I suggest your review this documentation since there are various ways to make a dll available for runtime loading.

    dynamic-link-library-search-order

    For example, one way would be to configure your project properties so that the working directory when running your executable is the directory containing the dll that you want to load.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Flaviu_ 1,091 Reputation points
    2022-11-22T09:25:40.453+00:00

    Yes, I have found the issue: I need to load from PATH some directory in VC++ Directories, and it didn't load it because I should restart Visual Studio Environment to re-load new path from PATH (system PATH). And I was searching for other methods to load that dll from another path than the current project directory, but it has been solved.

    Anyway, I learnt a lot within these posts, so, I kindly thank you, all of you. I accept the answer the first one, but I it could be accepted any of them as answer.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.