Re: more on undefined reference to 'pg_detoast_datum'

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: stimits(at)comcast(dot)net
Cc: postgresql <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: more on undefined reference to 'pg_detoast_datum'
Date: 2003-10-13 16:06:58
Message-ID: 3F8ACDA2.7050802@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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(at)Yahoo(dot)com #

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2003-10-13 17:40:11 Re: Performance weirdness with/without vacuum analyze
Previous Message Thomas LeBlanc 2003-10-13 15:58:55 Create Function... ERROR: language "plpgsql" does not exist

Browse pgsql-interfaces by date

  From Date Subject
Next Message D. Stimits 2003-10-14 01:48:38 Re: [INTERFACES] more on undefined reference to 'pg_detoast_datum'
Previous Message Tom Lane 2003-10-13 14:42:40 Re: more on undefined reference to 'pg_detoast_datum'