Thread: contrib Makefiles

contrib Makefiles

From
"Christopher Kings-Lynne"
Date:
Hi guys,

The fulltextindex Makefile looks like this:

subdir = contrib/fulltextindex
top_builddir = ../..
include $(top_builddir)/src/Makefile.global

MODULE_big = fti
OBJS = list.o chtbl.o fti.o
DATA_built = fti.sql
DOCS = README.fti
SCRIPTS = fti.pl

include $(top_srcdir)/contrib/contrib-global.mk

How can I modify it to build two different C files into two different .so's?

I want to have fti.so and fti2.so sort of thing...

Chris



Re: contrib Makefiles

From
Peter Eisentraut
Date:
Christopher Kings-Lynne writes:

> How can I modify it to build two different C files into two different .so's?

That is next to impossible in the current setup.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: contrib Makefiles

From
"Christopher Kings-Lynne"
Date:
Is it possible to have two different functions in the .so that can be made
into two different postgres funtions, both referencing the same .so?

Chris

> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net]
> Sent: Thursday, 15 August 2002 6:02 AM
> To: Christopher Kings-Lynne
> Cc: Hackers
> Subject: Re: [HACKERS] contrib Makefiles
>
>
> Christopher Kings-Lynne writes:
>
> > How can I modify it to build two different C files into two
> different .so's?
>
> That is next to impossible in the current setup.
>
> --
> Peter Eisentraut   peter_e@gmx.net
>



Re: contrib Makefiles

From
Tom Lane
Date:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> Is it possible to have two different functions in the .so that can be made
> into two different postgres funtions, both referencing the same .so?

Certainly, what's the problem there?  Offhand I can't think of any
contrib modules that only define one function...
        regards, tom lane


Re: contrib Makefiles

From
"Christopher Kings-Lynne"
Date:
> "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> > Is it possible to have two different functions in the .so that
> can be made
> > into two different postgres funtions, both referencing the same .so?
>
> Certainly, what's the problem there?  Offhand I can't think of any
> contrib modules that only define one function...

OK then,

I guess my question would be that currently fulltextindex generates SQL like
this:

create function fti() returns opaque as       '$libdir/fti'       language 'C';

So it references the fti.so, but where does it say what function to actually
run in fti.so?  Or is it assumed in C functions that the function to call in
the shared object is the same as the name of the function???

Chris



Re: contrib Makefiles

From
Joe Conway
Date:
Christopher Kings-Lynne wrote:
> create function fti() returns opaque as
>         '$libdir/fti'
>         language 'C';
> 
> So it references the fti.so, but where does it say what function to actually
> run in fti.so?  Or is it assumed in C functions that the function to call in
> the shared object is the same as the name of the function???
> 

It does if you're not specific. Take a look at dblink.sql.in. All of the 
dblink functions are in one shared object file.

e.g.
CREATE OR REPLACE FUNCTION dblink (text,text) RETURNS setof int  AS 'MODULE_PATHNAME','dblink' LANGUAGE 'c'  WITH
(isstrict);

CREATE OR REPLACE FUNCTION dblink_tok (int,int) RETURNS text  AS 'MODULE_PATHNAME','dblink_tok' LANGUAGE 'c'  WITH
(isstrict);
...
etc.

Joe



Re: contrib Makefiles

From
Tom Lane
Date:
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> I guess my question would be that currently fulltextindex generates SQL like
> this:

> create function fti() returns opaque as
>         '$libdir/fti'
>         language 'C';

> So it references the fti.so, but where does it say what function to actually
> run in fti.so?  Or is it assumed in C functions that the function to call in
> the shared object is the same as the name of the function???

That's the assumption unless you specify differently.  Time to reread
the CREATE FUNCTION man page ...
        regards, tom lane


Re: contrib Makefiles

From
Bruce Momjian
Date:
Yes, you can optionally specify the symbol to find in the *.so file as
part of the CREATE FUNCTION command.

---------------------------------------------------------------------------

Tom Lane wrote:
> "Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> > I guess my question would be that currently fulltextindex generates SQL like
> > this:
> 
> > create function fti() returns opaque as
> >         '$libdir/fti'
> >         language 'C';
> 
> > So it references the fti.so, but where does it say what function to actually
> > run in fti.so?  Or is it assumed in C functions that the function to call in
> > the shared object is the same as the name of the function???
> 
> That's the assumption unless you specify differently.  Time to reread
> the CREATE FUNCTION man page ...
> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073