compile: link dynamic OR static library in Windows

Alexander Zhirov azhirov1991 at gmail.com
Mon Feb 6 06:38:03 UTC 2023


On Monday, 6 February 2023 at 05:45:35 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> Ah doh, MSVC link doesn't use -L.
>
> $ dmd -i "-L/LIBPATH:C:\Program Files\PostgreSQL\15\lib" -Llpq 
> app.d
>
> I think that is the option you want.
>
> Worst case scenario just copy the files to your working 
> directory and it should find it without the additional search 
> path.

He doesn't want to anyway. I have already put the library in the 
source code folder. But it still pulls up the `*.obj` format for 
some reason.

```sh
C:\sources\pxe-restore\source>ls
app.d  app.obj  arsd  azh  libpq.lib  pkg

C:\sources\pxe-restore\source>dmd -i "-L/LIBPATH:C:\Program 
Files\PostgreSQL\15\lib" -Llpq app.d
LINK : fatal error LNK1181: не удается открыть входной файл 
"lpq.obj"
Error: linker exited with status 1181

C:\sources\pxe-restore\source>dmd -i 
"-L/LIBPATH:C:\sources\pxe-restore\source" -Llpq app.d
LINK : fatal error LNK1181: не удается открыть входной файл 
"lpq.obj"
Error: linker exited with status 1181
```


More information about the Digitalmars-d-learn mailing list