How to link to a dylib ?

To be used with the -l linker flag the installed dylib file must have a name starting with lib. Renaming your dylib file (the one installed in the search path) from MyLib to libMyLib should solve the problem of the linker not seeing your dylib.
(You may discover other problems after that of course…)