Re: Triggers - Mailing list pgsql-cygwin

From Jason Tishler
Subject Re: Triggers
Date
Msg-id 20030221182942.GD1408@tishler.net
Whole thread Raw
In response to Triggers  (Alan Clucas <alanc@pipstechnology.co.uk>)
List pgsql-cygwin
Alan,

On Fri, Feb 21, 2003 at 09:27:06AM +0000, Alan Clucas wrote:
> I am trying to create a simple trigger for postgres under cygwin in C.
> Trying to compile one of the demonstration files (refint) in
> C:\cygwin\usr\src\postgresql-7.3.1-1\contrib\spi\

Why not use make?

> postgres@alanc-xp /usr/src/postgresql-7.3.1-1/contrib/spi
> $ gcc -I../../src/include -I../../src/backend   -O2 -Wall
> -Wmissing-prototypes -O6 -fpic -I../../src/include   -c refint.c -o refint.o
> cc1: warning: -fpic ignored for target (all code is position independent)
>
> postgres@alanc-xp /usr/src/postgresql-7.3.1-1/contrib/spi
> $ gcc -shared -o refint.so refint.o
> refint.o(.text+0x302):refint.c: undefined reference to `_elog'
> refint.o(.text+0x363):refint.c: undefined reference to `_elog'
> refint.o(.text+0x389):refint.c: undefined reference to `_SPI_connect'
> <SNIP - lots and lots of missing references>

Instead of the above you would get the following:

    $ make -n refint.dll
    gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations  -DREFINT_VERBOSE -I. -I../../src/include   -c -o
refint.orefint.c 
    dlltool --export-all --output-def refint.def refint.o
    dllwrap -o refint.dll --def refint.def refint.o ../../src/utils/dllinit.o -L../../src/backend -lpostgres
    rm -f refint.def
    rm refint.o

> As far as I can gather the undefined references shouldn't be resolved
> at this point, instead they are resolved when the object is loaded
> into postgres.

No, this is Windows and not Unix.  Cygwin does a lot, but it can only do
so much...

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

pgsql-cygwin by date:

Previous
From: "Jennifer Lee"
Date:
Subject: database's on a separate partition
Next
From: Peter Eisentraut
Date:
Subject: Re: database's on a separate partition