Hi,
I need to extend postgreSQL to support some specific function I will
code in C (ideally C++ if it can work!). I'm trying to run some simple
test and it doesn't seem to work. Here is the C code:
----------
#include "postgres.h"
#include <string.h>
int
add_one(int arg)
{ return arg + 1;
}
----------
Which is compiled with:
gcc -fpic -c -I/[ThePath]/postgresql-7.3.2/include/server/ pgsql_bio.c
gcc -shared -o pgsql_bio.so pgsql_bio.o
It compiles fine.
And then in postgreSQL as user postgres in database template1:
CREATE FUNCTION add_one(int4) RETURNS int4 AS '/[PathToTheObject]/pgsql_bio.so' LANGUAGE C WITH (isStrict);
Then I get:
ERROR: Can't find function add_one in file /[PathToTheObject]/pgsql_bio.so
I'm using PostgreSQL 7.3.2 on Redhat 7.2 (linux 2.4.7-10) and compiling
with gcc 2.95.3.
Following some suggestions I found on usenet, I ran 'nm' on the library
and I got the expected entry for my function:
00000700 T add_one
Anyone has an idea about what I am doing wrong? Any suggestion will be
welcome!
thanks,
--
Sebastien Lemieux
Bioinformatics, post-doc
Elitra-canada