xlc -o myprogram main.c -Ldirectory -ltest
where directory is
the path to the directory containing the library libtest.a.xlc -brtl -o myprogram main.c -Ldirectory -ltest
By using the -l option, you instruct the linker to search in the directory specified via the -L option for libtest.so; if it is not found, the linker searches for libtest.a. For additional linkage options, including options that modify the default behavior, see the AIX® ld documentation (http://publib.boulder.ibm.com/infocenter/aix/v7r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/ld.htm).