Lindenii Project Forge
Add basic FFI bindings
use types::c; export type conn = opaque; export @symbol("PQconnectdb") fn connectdb(conninfo: const *c::char) *conn; export @symbol("PQfinish") fn finish(conn: *conn) void;
use types::c; export @symbol("PQerrorMessage") fn errorMessage(conn: *conn) *c::char;
use types::c; export @symbol("PQexec") fn exec(conn: *conn, query: *c::char) *result;
use types::c; export type result = opaque; export @symbol("PQclear") fn clear(res: *result) void; export @symbol("PQnfields") fn nfields(res: *result) int; export @symbol("PQfname") fn fname(res: *result, field_num: int) *c::char; export @symbol("PQntuples") fn ntuples(res: *result) int; export @symbol("PQgetvalue") fn getvalue(res: *result, tup_num: int, field_num: int) *c::char; export @symbol("PQgetlength") fn getlength(res: *result, tup_num: int, field_num: int) int;
export @symbol("PQstatus") fn status(conn: *conn) ConnStatusType; export type ConnStatusType = enum int { OK, BAD, STARTED, MADE, AWAITING_RESPONSE, AUTH_OK, SETENV, SSL_STARTUP, NEEDED, CHECK_WRITABLE, CONSUME, GSS_STARTUP, CHECK_TARGET, CHECK_STANDBY, ALLOCATED, };