On other platforms the -Lfile I think would work. On Windows you have to link against the import library not DLL directly.
You can pass it to the compiler: $ dmd -i "-L/LIBPATH:C:\Program Files\PostgreSQL\15\lib" pq.lib app.dShould work. Sorry, I should have revisted this from the get go, rather than just tinkering with what others were posting.