Skip to main content

set_dylib_dirs

Function set_dylib_dirs 

Source
pub fn set_dylib_dirs(dirs: Vec<PathBuf>) -> Vec<PathBuf>
Expand description

Sets the directories a dylib import’s library is looked for in on this thread, and returns the ones that were in effect, so a caller can put them back.

A host whose native libraries do not sit beside the script names their directories here: an application that keeps its candela sources in src/ and its shared libraries in lib/ points this at lib/, and dylib "md" finds libmd.so there. A project that pulls packages in adds one entry per package root, so a package’s own native libraries load the same way. An empty list goes back to searching beside the importing file only.

The directories are searched in order, ahead of everything else; whatever the library name resolved to before is still tried after them, so a program that names a system library keeps working. The setting is read when a program is compiled and when a .cdlb artifact is loaded, so set it before either.