You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a great project and I'm very excited about this. My interest lies in building high perf PostgreSQL extensions with Ziglang. Here is my workflow
Compile mathtest.zig as shared dynamic library
Embed the add function in C file for postgresql
Compile using Makefile for Postgresql
Try to execute the file
Steps
mathtest.zig
exportfnadd(a: i32, b: i32) i32 {
returna+b;
}
zig build-lib mathtest.zig
funcs.c
#include"postgres.h"#include<string.h>#include"fmgr.h"#include"utils/geo_decls.h"#include"mathtest.h"#ifdefPG_MODULE_MAGICPG_MODULE_MAGIC;
#endif/* by value */PG_FUNCTION_INFO_V1(add_one);
Datumadd_one(PG_FUNCTION_ARGS)
{
int32arg=PG_GETARG_INT32(0);
PG_RETURN_INT32(add(arg,arg));
}
dropfunction if exists add_zig(integer);
CREATE or replaceFUNCTIONadd_zig(integer) RETURNS integerAS'/home/ranjanprj/zig/funcs.so', 'add_one'
LANGUAGE C STRICT;
ERROR
dropfunction if exists add_zig(integer);
CREATE or replaceFUNCTIONadd_zig(integer) RETURNS integerAS'/home/ranjanprj/zig/funcs.so', 'add_one'
LANGUAGE C STRICT;
Apparently it copies libmathtest.so.0 in /usr/lib/postgresql/11/lib directory, I tried to change the name in my current directory of libmathtest.so.0.0.0 to libmathtest.so.0 but it still didn't work
neither did copying libmathtest.so.0.0.0 to /usr/lib/postgresql/11/lib directory work.
Please note that same workflow works fine with rustlang shared lib by just replacing the .so file path in Makefile
Any help appreciated !
The text was updated successfully, but these errors were encountered:
Yes, I think I was looking for a way to skip the versioning generation stuff, is there a way that it can be skipped ? It would be cool we could build high perf extensions to PostgreSQL using Ziglang, as it has the right properties exactly for this use case.
Uh oh!
There was an error while loading. Please reload this page.
This is a great project and I'm very excited about this. My interest lies in building high perf PostgreSQL extensions with Ziglang. Here is my workflow
Steps
zig build-lib mathtest.zig
funcs.c
sudo make && sudo make install
neither did copying libmathtest.so.0.0.0 to /usr/lib/postgresql/11/lib directory work.
Please note that same workflow works fine with rustlang shared lib by just replacing the .so file path in Makefile
Any help appreciated !
The text was updated successfully, but these errors were encountered: