xlc -o myprogram main.c -Ldirectory [] -lfoo
where directory is
the path to the directory containing the library.xlc -brtl -o myprogram main.c -Ldirectory -lfoo
By using the -l option, you instruct the linker to search in the directory specified via the -L option for libfoo.so; if it is not found, the linker searches for libfoo.a. For additional linkage options, including options that modify the default behavior, see the AIX® ld documentation.