Author Topic: How to set the dll search path for executable?  (Read 4083 times)

Offline Krice

  • Almost regular
  • **
  • Posts: 150
How to set the dll search path for executable?
« on: July 02, 2023, 02:52:20 pm »
If you want to ship the program with .dlls and put them into a directory in the root, how do you tell this to the linker, or is it even possible? Usually you put dlls in the same directory with .exe, but this can be messy. Trust me, I have tried to google the answer to this literally for hours. There is -rpath linker option, but I can't figure out how it works. If you put that into extra linker options in C::B the linker doesn't know that command.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1564
Re: How to set the dll search path for executable?
« Reply #1 on: July 02, 2023, 05:12:25 pm »
Dll search path is an OS setting, the paths listed in the environment variable PATH are scanned.

Offline Krice

  • Almost regular
  • **
  • Posts: 150
Re: How to set the dll search path for executable?
« Reply #2 on: July 03, 2023, 09:29:15 am »
So it's only the directory where the .exe is or OS locations if they are set in path. Would have imagined you could at least set a relative path from the .exe location.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1564
Re: How to set the dll search path for executable?
« Reply #3 on: July 03, 2023, 10:35:31 am »
This page from M$ explains the DLL search algorithm in detail.