Problem creating a C function

Started by Mark R. Willalmost 24 years ago1 messagesgeneral
Jump to latest
#1Mark R. Will
digico@shaw.ca

I've compiled a C routine to be used as a database function on Postgres
7.1.3 installed on RedHat 7.1. No errors or warnings except when I try to
add it. I'm using the command:

CREATE OR REPLACE FUNCTION myfunc(text,int,int,int) RETURNS text AS
'$libdir/libmyfunc.so', 'myfunc' LANGUAGE C;

I'm getting the following message:

ERROR: Load of file /usr/lib/pgsql/libmyfunc.so failed:
/usr/lib/pgsql/libmyfunc.so: undefined symbol: MemoryContextFree

I know that MemoryContextFree is called by the pfree() macro, which I call a
number of times in the routine. The library libmyfunc.so is definitely in
/usr/lib/pgsql and if I specify the absolute path to it in the CREATE
command or drop the 'myfunc' bit just before LANGUAGE I still get the exact
same message. If it helps any, the source code uses this sequence of
includes:

#include "postgres.h"
#include "executor/executor.h"
#include "executor/spi.h"
#include <string.h>
#include "fmgr.h"

Any ideas on what might be happening? Thx.

- Mark.

Attachments:

winmail.datapplication/ms-tnef; name=winmail.datDownload