title: gcc/ld: what is to -Wl,-rpath in dynamic linking what -l is to -L in static linking?
body: <p><strong>With /my/dir/path/foo.a and /my/dir/path/bar.a:</strong></p>
  
  <p>To statically link using gcc/g++, one uses <code>-L</code> to specify the directory containing the static libraries and <code>-l</code> to specify the name of the library. In this case one would write <code>gcc -L/my/dir/path -lfoo -lbar ...</code>.</p>
  
  <p><strong>With /my/dir/path/foo.so and /my/dir/path/bar.so:</strong></p>
  
  <p>To dynamically link using gcc/g++, one uses <code>-Wl,-rpath,/my/dir/path</code>. How are the names of the libraries specified? Is the command <code>gcc -L/my/dir/path -Wl,-rpath,/my/dir/path -lfoo -lbar ...</code> correct? Or should it be <code>gcc -L/my/dir/path -Wl,-rpath,/my/dir/path -Wl,-lfoo -Wl,-lbar ...</code>? In other words, do the library names need to be passed on to the linker through <code>-Wl,-l</code>?</p>