I have never programmed in Windows, so I don't quite understand how to link the library correctly. I have a compiled Postgres library from under mingw. There is both a static library *.a
and a dynamic library *.dll
. I don't understand how to compile my project correctly at all. I tried to do everything through dub first.json, then I realized that the idea was too rash and decided to compile a simple project through the CLI. In the end , here 's what happened:
PS C:\sources\pxe-restore\source> dmd -i app.d -LC:\msys64\home\user\postgresql-15.1\installed\mingw64\lib\libpq.dll
lld-link: error: C:\msys64\home\user\postgresql-15.1\installed\mingw64\lib\libpq.dll: bad file type. Did you specify a DLL instead of an import library?
lld-link: error: could not open 'pq.lib': no such file or directory
Error: linker exited with status 1
After Googling a bit, I came across this page. Do I really need to rewrite the header of the Postgres library to use it in my project?
Do I need to list all the functions called from the library? Or is there a way to somehow attach it in a more civilized way through a simple dmd
?