[lug] C extensions of PostgreSQL

D. Stimits stimits at comcast.net
Wed Aug 6 08:48:10 MDT 2003


Kenneth D. Weinert wrote:

> On Wed, Aug 06, 2003 at 06:29:26AM -0600, D. Stimits wrote:
>
> >I'm trying to write a C function for PostgreSQL on RH 7.3 (KRUD), and
> >running into a problem. The C code must apparently link against a
> >library that provides functions "CurrentMemoryContext" and
> >"MemoryContextAlloc" (probably due to palloc). I've been digging around
> >with nm and fail to find it. I'm currently linking as:
> >  -lkrb5 -lk5crypto -lcom_err -lpq -ldl
>
>
> Mind you, I know nothing about this, but a bit of googling brought
> up the following links which may or may not be useful:
>
> http://www.faqchest.com/prgm/pgsql-l/pgsql-99/pgsql-9911/pgsql-991102/pgsql99110500_01856.html


This seems to be an error (for that URL) at the time of trying to load 
the .so into PostgreSQL, whereas my error is at compile time. Both are 
related, because both need to reference an outside library to gain an 
implementation of the missing symbols, but in my case it is at a much 
earlier stage.

>
> http://www.faqchest.com/prgm/pgsql-l/pgsql-00/pgsql-0010/pgsql-001035/pgsql00101809_15133.html
>
> Most of the links I saw made it seem like this was a problem that was
> Solaris specific, so these links could be totally useless.
>
Unfortunately it isn't Solaris specific. The "fix" url also seems to be 
missing. Basically, there must be a dynamically loadable library that 
provides CurrentMemoryContext and MemoryContextAlloc, and I can't figure 
out which one it is. Because it is dynamically loadable, someone can 
download a binary version of this and not get the error until loading 
the module...in my case I am creating the C module and using it inside 
of the module so I get the error just compiling. It is possible I am 
doing something else wrong.

D. Stimits, stimits AT comcast DOT net




More information about the LUG mailing list