Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: Krice on July 02, 2023, 02:52:20 pm

Title: How to set the dll search path for executable?
Post by: Krice 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.
Title: Re: How to set the dll search path for executable?
Post by: Miguel Gimenez 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.
Title: Re: How to set the dll search path for executable?
Post by: Krice 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.
Title: Re: How to set the dll search path for executable?
Post by: Miguel Gimenez on July 03, 2023, 10:35:31 am
This page (https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order) from M$ explains the DLL search algorithm in detail.