Possible Duplicate:
How to use dylib in Mac OS X (C++)
I have the following files:
- lost.h
- lost.dylib
I am struggling with the concept of how my C program knows where my lost.dylib file lives? At the top of my file I do an include #include "lost.h" but how does my program know about my lost.dylib?
At link time it uses a combination of standard directories and user specified directories
Linker options has more information. Basically using -L option you can specify more directories to search for dylib that you are interested in.
If you are using Xcode, this link has more details
As far as runtime finding of the dynamic library is concerned. OS X does it a little bit different that other platforms. OS X embeds an “install name” inside each dynamic library. You can use
otool -Lto find the details