Thread
-
Re: [GENERAL] Trying to make functions in 'C'
selkovjr@mcs.anl.gov — 1999-05-16T19:24:24Z
> I'm tying to learn how to make function in 'C'. > I'm trying to compile a program I made in 'C'. > The command I gave were: > > % gcc -fPIC -c addone.c -I/usr/local/pgsql/include > % ld -G -Bdynamic -o addone.so addone.o > > and created the function in postgres like this: > > CREATE FUNCTION add_one(int4) RETURNS int4 > AS './addone.so' LANGUAGE 'c'; ^^^^^^^^^^^^^ one must provide an absolute path here --Gene -
Re: [INTERFACES] problem with LOAD
Oleg Bartunov <oleg@sai.msu.su> — 1999-05-20T16:41:36Z
This is a known problem with FreeBSD-3.1 and PostgreSQL I had too with 6.5 cvs version. I suppose you use FreeBSD elf ? Take a look to ports for freebsd-elf specific patches or just change src/Makefile.shlib ifeq ($(PORTNAME), freebsd) ifdef BSD_SHLIB install-shlib-dep := install-shlib ifdef ELF_SYSTEM shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) LDFLAGS_SL := -x -shared -soname $(shlib) else shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) LDFLAGS_SL := -x -Bshareable -Bforcearchive endif CFLAGS += $(CFLAGS_SL) endif endif and makefiles/Makefile.freebsd ifdef ELF_SYSTEM LDFLAGS+= -export-dynamic endif %.so: %.o ifdef ELF_SYSTEM $(LD) -x -shared -o $@ $< else $(LD) -x -r -o $<.obj $< @echo building shared object $@ @rm -f $@.pic @${AR} cq $@.pic order $<.obj | tsort ${RANLIB} $@.pic @rm -f $@ $(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic endif This works for me ! Regards, Oleg PS. These patches are already applied to current 6.5 sources. On Thu, 20 May 1999, abdelkrim wrote: > Date: Thu, 20 May 1999 18:06:30 +0000 > From: abdelkrim <haj@idianet.net> > To: pgsql-general@postgresql.org, pgsql-interfaces@postgresql.org > Subject: [INTERFACES] problem with LOAD > > hello every body > > i have some problem with LOAD command > > postgres=> LOAD '/usr/local/pgsql/complex.so'; > pqReadData() -- backend closed the channel unexpectedly. > This probably means the backend terminated abnormally before or while > processing the request. > We have lost the connection to the backend, so further processing is > impossible. Terminating. > $>> > > I build complex.so by: > > >> gcc -I../include -I../backend -O2 -m486 -pipe -Wall > -Wmissing-prototypes -I../interfaces/libpq -I../../include -c > complex.c -o complex.o > >> ld -x -r -o complex.o.obj complex.o > >> ranlib complex.so.pic > >> ld -x -Bshareable -o complex.so complex.so.pic > > I use FreeBSD-3.1 with PostgreSQL 6.4.2 > > thanks > > > _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 -
problem with LOAD
Jonathan davis <haj@idianet.net> — 1999-05-20T18:06:30Z
hello every body i have some problem with LOAD command postgres=> LOAD '/usr/local/pgsql/complex.so'; pqReadData() -- backend closed the channel unexpectedly. This probably means the backend terminated abnormally before or while processing the request. We have lost the connection to the backend, so further processing is impossible. Terminating. $>> I build complex.so by: >> gcc -I../include -I../backend -O2 -m486 -pipe -Wall -Wmissing-prototypes -I../interfaces/libpq -I../../include -c complex.c -o complex.o >> ld -x -r -o complex.o.obj complex.o >> ranlib complex.so.pic >> ld -x -Bshareable -o complex.so complex.so.pic I use FreeBSD-3.1 with PostgreSQL 6.4.2 thanks