Re: more on undefined reference to 'pg_detoast_datum' - Mailing list pgsql-interfaces

From Jan Wieck
Subject Re: more on undefined reference to 'pg_detoast_datum'
Date
Msg-id 3F8ACDA2.7050802@Yahoo.com
Whole thread Raw
In response to Re: more on undefined reference to 'pg_detoast_datum'  ("D. Stimits" <stimits@comcast.net>)
List pgsql-interfaces
D. Stimits wrote:

> My attempt to try linking against some of the client libraries was to 
> find a link source for CurrentMemoryContext and MemoryContextAlloc. The 
> headers for backend development include prototypes as extern for many 
> functions, such as those above. It's painfully obvious that glibc does 
> not provide these definitions, and it is obvious also that the client 
> libraries do not implement these. My question is, where the heck is 
> CurrentMemoryContext and MemoryContextAlloc provided as an 
> implementation which I can link with? It looks like the Redhat 7.3 
> (PostgreSQL 7.2.3) devel rpm package is missing the library needed. Or 
> perhaps there is no such library, and I'd be required to drop my code 
> into the complete source of the SQL server itself, which is most 
> inconvenient. How the heck do I find an implentation of 
> CurrentMemoryContext and MemoryContextAlloc? Running ldd on sample 
> contrib libraries leads me to believe that in order to build this code, 
> I must have a built full PostgreSQL source installed and configured, and 
> that these functions are not available as a linkable library. Which .o 
> object file would I link? Why isn't CurrentMemoryContext or 
> MemoryContextAlloc available in a linkable library instead?

I am still confused about what you're trying to build.

Anyhow, CurrentMemoryContext and MemoryContextAlloc are global symbols 
of the servers backend memory management system. If you're building a 
function that you plan to load dynamically into the database server 
process via CREATE FUNCTION, then you will definitely NOT link against 
libpq and should follow the plenty examples as suggested by Tom.

If you are developing a client application that will connect to a 
backend via the libpq client library, than you don't have these 
functions/globals available. We do not provide this memory management 
system as a standalone, linkable library.


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: more on undefined reference to 'pg_detoast_datum'
Next
From: Tom Lane
Date:
Subject: Re: libpq/async notifications