I now have the following working on Linux and macOS.
-----
name "myapp"
targetType "executable"
description "A minimal D application."
authors "bartland"
copyright "Copyright © 2019, bartland"
license "public"
libs "mylib"
lflags "-L../../_cache/" "-rpath" "../../_cache/"
-------
What is the approach on Windows these days (many posts on the
matter seem out of date)? The shared C dll was built in
MSYS2/MINGW32.
On Windows (PATH=C:\D\dmd2\windows\bin;C:\D\dmc\dm\bin):
(Looks like it's invoking the MS linker?)
Linking...
C:\D\dmd2\windows\bin\dmd.exe
-of.dub\build\application-debug-windows-x86_64-dmd_2089-5F4166A8E1793C219FB49EC77A7D7D35\myapp.exe .dub\build\application-debug-windows-x86_64-dmd_2089-5F4166A8E1793C219FB49EC77A7D7D35\myapp.obj mylib.lib -L-L../../_cache/ -L-rpath -L../../_cache/ -m64 -g
LINK : warning LNK4044: unrecognized option '/L../../_cache/';
ignored
LINK : warning LNK4044: unrecognized option '/rpath'; ignored
LINK : fatal error LNK1104: cannot open file '../../_cache/.obj'
Error: linker exited with status 1104