From: | Gayathri TK <gtambar(at)ncsu(dot)edu> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Accessing libq functions from UDF (shared library) |
Date: | 2005-11-09 07:18:34 |
Message-ID: | 4371A2CA.2040001@ncsu.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
I am trying to create a User-defined function(UDF) which takes filename
as input.. the function reads the file containig sql queries and
executes them in background using libq functions (PGconnectDb, PQexec
etc..).
I was able to sucessfully compile the code and create a shared library.
This is my makefile:
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
SERVER_INCLUDES += -I $(shell pg_config --includedir)
SERVER_INCLUDES += -I $(shell pg_config --includedir-server)
CFLAGS += -g $(SERVER_INCLUDES)
.SUFFIXES: .so
.c.so:
$(CC) $(CFLAGS) -fpic -c $<
$(CC) $(CFLAGS) -shared -o $@ $(basename $<).o
But when i tried creating a UDF using 'CREATE OR REPLACE FUNCTION' , i
get the following error:
--> ERROR: Could not load library: .../pgsql/lib/mylib.so : undefined
symbol PGConnectdb
My LD_LIBRARY_PATH is set to point to <...>/pgsql/lib dirctory (which
contains all the libarary files needed...)..
$> ldd mylib.so gives the following output:
libc.so.6 => /lib/tls/libc.so.6/
/lib/ld-linux.so.2
Am i missing something?
Would really appreciate any help in this regard.
Thanks in advance,
Gayathri TK
From | Date | Subject | |
---|---|---|---|
Next Message | ITAGAKI Takahiro | 2005-11-09 07:25:11 | Optimization of the alignment padding |
Previous Message | Robert Creager | 2005-11-09 03:29:25 | Re: SIGSEGV taken on 8.1 during dump/reload |