Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] Shared lib grief with 6.4.2

From: Jonathan Davis <haj(at)idianet(dot)net>
To: Matthew Hagerty <matthew(at)venux(dot)net>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Shared lib grief with 6.4.2
Date: 1999-05-26 10:46:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
Matthew Hagerty wrote:

> Greetings,
> I'm trying to create a simple function for postgres-6.4.2 under
> FreeBSD-3.1-RELEASE and GCC-  This is the program code, simply
> converts a bool to int4:
> #include "../include/postgres.h"
> int4
> bool2int(bool bCondition)
> {
>     if (bCondition)
>         return(1);
>     else
>         return(0);
> }
> Then on the command line to create the shared lib and a file command to
> ensure I created a shared lib:
> # gcc -shared -I../include -o bool2int.c
> # file
> ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD),
> not stripped
> Then in psql:
> => create function bool2int(bool) returns int4 as
> '/usr/local/pgsql/procs/' language 'c';
> => select bool2int(1=1);
> ERROR:  Can't find function bool2int in file /usr/local/pgsql/procs/
> =>
> Any insight as to why this does not work would be greatly appreciated.
> Thank you,
> Matthew Hagerty

I do the same thing, and  in psql:

postgres=> select bool2int(1=1);
assertion "u.hdr.e_phentsize == sizeof(Elf_Phdr)" failed: file
"/usr/src/libexec/rtld-elf/map_object.c", line 118
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.

to create the shared lib:

gcc -I../include -I../backend   -O2 -m486 -pipe  -Wall -Wmissing-prototypes
-I../interfaces/libpq -I../../include   -c bool2int.c -o bool2int.o
bool2int.c:6: warning: no previous prototype for `bool2int'
ld -x -r -o bool2int.o.obj bool2int.o
building shared object
ld -x -Bshareable -o

I use  FreeBSD-3.1

In response to


pgsql-interfaces by date

Next:From: Steven M. WheelerDate: 1999-05-26 18:51:19
Subject: PG 6.5 and perl5
Previous:From: Oleg BartunovDate: 1999-05-26 09:51:58
Subject: Re: [INTERFACES] Shared lib grief with 6.4.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group