Thread overview
Didn't take this newbie long to hit the first roadblock
Jul 19
kp
Jul 19
kp
July 19

There isn't a pg.lib file in my PG17 installation on Win11 Pro - the closest I see is postgres.lib. What did I miss?

----------------------------- D source code ------------------------------------

import dpq2;
import std.stdio;

void main() {
    // Adjust credentials as needed
    string connStr = "host=localhost port=5432 dbname=postgres user=postgres password=iwed";

    try {
        auto conn = new Connection(connStr);
        auto result = conn.exec("SELECT version(), current_date");

        writeln("Connected to PostgreSQL!");
        writeln("PostgreSQL version: ", result[0][0].as!PGtext);
        writeln("Current date: ", result[0][1].as!PGtext);
    } catch (Exception e) {
        writeln("Connection failed: ", e.msg);
    }
}

----------------- DUB.JSON ---------------------------------

{
  "description": "A minimal D application.",
  "license": "MIT",
  "name": "pg_app",
  "authors": [
    "me"
  ],
  "copyright": "Copyright © 2025, me",
  "dependencies": {
    "dpq2": "~>1.2.3"
  },
}

------------------- build output ---------------------------------------------

D:\projects\D\GUI_App>dub build
    Starting Performing "debug" build using D:\D\dmd2\windows\bin64\dmd.exe for x86_64.
  Up-to-date derelict-pq 4.0.0: target for configuration [derelict-pq-static] is up to date.
  Up-to-date money 3.0.2: target for configuration [library] is up to date.
  Up-to-date stdx-allocator 2.77.5: target for configuration [library] is up to date.
  Up-to-date vibe-container 1.6.2: target for configuration [library] is up to date.
  Up-to-date vibe-serialization 1.0.7: target for configuration [library] is up to date.
    Building pg_app ~master: building configuration [application]
     Linking pg_app
LINK : fatal error LNK1104: cannot open file 'pq.lib'
Error: linker exited with status 1104
July 19
A quick look for dpq2 shows that by default it is configured to use a static binding to PostgreSQL client library.

https://github.com/denizzzka/dpq2/blob/master/dub.json#L20

It explicitly adds a shared library dependency on it (``libs`` directive). Which is appropriate if you are on a posix system with a package manager.

Naturally for a Windows user that isn't available to you.

You want the configuration "dynamic" instead.

Copy the appropriate shared library next to your executable and if the names line up, it should work.

```json
"subConfigurations": {
	"dpq2": "dynamic"
}
```

Here is the default names its looking for:

https://github.com/DerelictOrg/DerelictPQ/blob/master/source/derelict/pq/dynload.d#L552
July 19
On Saturday, 19 July 2025 at 03:01:51 UTC, Richard (Rikki) Andrew Cattermole wrote:
> A quick look for dpq2 shows that by default it is configured to use a static binding to PostgreSQL client library.
>
> https://github.com/denizzzka/dpq2/blob/master/dub.json#L20
>
> It explicitly adds a shared library dependency on it (``libs`` directive). Which is appropriate if you are on a posix system with a package manager.
>
> Naturally for a Windows user that isn't available to you.
>
> You want the configuration "dynamic" instead.
>
> Copy the appropriate shared library next to your executable and if the names line up, it should work.
>
> ```json
> "subConfigurations": {
> 	"dpq2": "dynamic"
> }
> ```
>
> Here is the default names its looking for:
>
> https://github.com/DerelictOrg/DerelictPQ/blob/master/source/derelict/pq/dynload.d#L552

Much appreciated - thanks