CurrentMemoryContext

Started by Bob Parkinsonover 25 years ago3 messagesgeneral
Jump to latest
#1Bob Parkinson
rwp@biome.ac.uk

Is CurrentMemoryContext a postgres symbol that I can link against?

Sorry if this is not a postgres question, it may be down to my ignorance
of C, perl or something else.

I've got a bit of code (a stemmer written in C) that I want to make
accessable to postgres, as a .so, and perl. The .so bit works, but I'm
trying to now build the Perl module calling the C code. I'm getting

Undefined symbol "CurrentMemoryContext"

I can see this symbol refered to in palloc.h but beond that I'm stuck.

Bob Parkinson
rwp@biome.ac.uk
------------------------------------------------------------------
Technical Manager: Biome http://biome.ac.uk/

Greenfield Medical Library,
Queens Medical Centre,
Nottingham. 0115 9249924 x 42059
------------------------------------------------------------------
We are stardust

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bob Parkinson (#1)
Re: CurrentMemoryContext

Bob Parkinson <rwp@biome.ac.uk> writes:

Is CurrentMemoryContext a postgres symbol that I can link against?

Yes, it should be accessible to shared libs that are loaded into a
backend.

accessable to postgres, as a .so, and perl. The .so bit works, but I'm
trying to now build the Perl module calling the C code. I'm getting

Undefined symbol "CurrentMemoryContext"

If I'm visualizing your setup correctly, you are trying to load this
code into a Perl executable? It's not going to work to load backend
code into Perl, because none of the backend support routines are going
to be accessible. Probably CurrentMemoryContext is just by chance the
first unresolvable symbol the linker found --- there'll be more if you
get past that one.

Code that's supposed to go into non-backend contexts shouldn't be using
any Postgres-specific include files...

regards, tom lane

#3Bob Parkinson
rwp@biome.ac.uk
In reply to: Tom Lane (#2)
Re: CurrentMemoryContext

I was trying to have a single .so that I can use in postgres, but
also by a perlXS function. I want access to the same function within
postgres, and externally in perl. Trying to get a single bit of code.

I'll restructure this bit of code, to take you comments into account.

cheers,

Bob

On Tue, 7 Nov 2000, Tom Lane wrote:

Bob Parkinson <rwp@biome.ac.uk> writes:

Is CurrentMemoryContext a postgres symbol that I can link against?

Yes, it should be accessible to shared libs that are loaded into a
backend.

accessable to postgres, as a .so, and perl. The .so bit works, but I'm
trying to now build the Perl module calling the C code. I'm getting

Undefined symbol "CurrentMemoryContext"

If I'm visualizing your setup correctly, you are trying to load this
code into a Perl executable? It's not going to work to load backend
code into Perl, because none of the backend support routines are going
to be accessible. Probably CurrentMemoryContext is just by chance the
first unresolvable symbol the linker found --- there'll be more if you
get past that one.

Code that's supposed to go into non-backend contexts shouldn't be using
any Postgres-specific include files...

regards, tom lane

Bob Parkinson
rwp@biome.ac.uk
------------------------------------------------------------------
Technical Manager: Biome http://biome.ac.uk/

Greenfield Medical Library,
Queens Medical Centre,
Nottingham. 0115 9249924 x 42059
------------------------------------------------------------------
We are stardust