Skip to content

Dynamic linking issue using the embedded Postgres #1

@georgelemon

Description

@georgelemon

Understand how to passL path to the libpq.dylib so that the db_connector can find it when using the embedded Postgres.

For now one of the best solution is to use push/pop dynlib pragmas around the code that uses the db_connector to ensure it can find the correct version of libpq.

{.push dynlib: currentSourcePath().parentDir / "greskewelbox" / "bin" / "16.9.0" / "darwin" / "lib" / "libpq.dylib".}
let db = open("localhost", "postgres", "postgres", "postgres")
db.exec(sql"""CREATE TABLE myTable (id integer, name varchar(50) not null)""")
db.exec(sql"""INSERT INTO myTable (id, name) VALUES (1, 'Alice')""")
for row in db.getAllRows(sql"""SELECT * FROM myTable"""):
echo "Row: ", row
{.pop.}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions