[...]
>> An rpath of . means it looks in the current directory at the time of
>> execution, not in the same location as the object containing the rpath.
>
> That's bad. Can I add a flag that the rpath should be relative to the other
> DLL?
,----
| RPATH TOKEN EXPANSION
| The runtime linker provides a number of tokens that can be used
| in an rpath specification (DT_RPATH or DT_RUNPATH).
|
| $ORIGIN
| ld.so understands the string $ORIGIN (or equivalently
| ${ORIGIN}) in an rpath specification to mean the
| directory containing the application executable. Thus,
| an application located in somedir/app could be compiled
| with gcc -Wl,-rpath,'$ORIGIN/../lib' so that it finds an
| associated shared library in somedir/lib no matter where
| somedir is located in the directory hierarchy.
`---- [ld.so(8)]
BTW, a 'shared object' is something very much different than a
'dynamic link libray' which often isn't/ can't be shared dynamically
because it doesn't use position-independent code.