On Saturday, 4 February 2023 at 15:52:33 UTC, Alexander Zhirov wrote:

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

through a simple `dmd`?

On Windows, dub's default behavior is to search for "foo.lib", usually compiled with Visual Studio C/C++ compilers. However, you have mingw-compiled "libfoo.a". I would not use MinGW-compiled libs with d compilers. I don't know how d compilers improved to support it, but in the past, I experienced ABI compatibility issues with d and MinGW.

I took a quick look at https://www.postgresql.org/download/. When I tried to download, I saw that the archive contained *.lib files. So, why don't you use them?

you will also need definitions of the functions in your d code like `extern(C) void fooDB();`. I am not sure how [importC](https://dlang.org/spec/importc.html) is usable with PostgreSQL. In addition, there are some bindings in the dub registry https://code.dlang.org/search?q=PostgreSQL.

      • Re: com... user1234 via Digitalmars-d-learn
        • Re:... Alexander Zhirov via Digitalmars-d-learn
          • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
            • ... Alexander Zhirov via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Alexander Zhirov via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Alexander Zhirov via Digitalmars-d-learn
              • ... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
              • ... Alexander Zhirov via Digitalmars-d-learn
  • Re: compile: lin... Ferhat Kurtulmuş via Digitalmars-d-learn

Reply via email to