Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make my program search specific folders for dependencies?

When my program opens, before any of my code actually runs, it will automatically attempt to load various DLLs whose functions it imports. It looks in the folder that the app is in, and then in a few specific places like \Windows and \Windows\System32.

If I want to use some custom DLLs, but I don't want to clutter up the app's folder with them, is there a way to install them to a subfolder and then put something into the EXE that tells it where to look?

like image 954
Mason Wheeler Avatar asked Feb 26 '23 23:02

Mason Wheeler


1 Answers

You must change PATH environment variable. Try using SetDllDirectory() function. Otherwise, you will have to dynamically load your DLLs.

Also see this question to avoid some more possible problems.

like image 66
ffriend Avatar answered May 06 '23 21:05

ffriend