Problem running C function
От | Luca Carrettin |
---|---|
Тема | Problem running C function |
Дата | |
Msg-id | HNEHLEADNHCKABLPOHLEOEAICAAA.lucacarrettin@sogeasoft.com обсуждение исходный текст |
Ответы |
Re: Problem running C function
|
Список | pgsql-novice |
I'm trying to compile and run my first C function on server side. I considered this simple example from the programmer's guide: #include "postgres.h" #include "fmgr.h" PG_FUNCTION_INFO_V1(add_one); Datum add_one(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); PG_RETURN_INT32(arg + 1); } I compiled the file libtest.c containing this code and generated libtest.so on a Linux machine by the following commands: cc -fpic -c libtest.c cc -shared -o libtest.so libtest.o Then I registered the function add_one like said in the programmer's guide: CREATE FUNCTION add_one(int4) RETURNS int4 AS .../libtest.so LANGUAGE c WITH (isStrict); Now, when executing SELECT add_one(10); I get the following message: ERROR: Load of file .../libtest.so failed: undefined symbol: PG_GETARG_INT32 Can somebody help me? Thanks. Luca.
В списке pgsql-novice по дате отправления: