Re: Triggers

From: Jason Tishler <jason(at)tishler(dot)net>
To: Alan Clucas <alanc(at)pipstechnology(dot)co(dot)uk>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: Triggers
Date: 2003-02-21 18:29:43
Message-ID: 20030221182942.GD1408@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)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(at)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.o refint.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

In response to

  • Triggers at 2003-02-21 09:27:06 from Alan Clucas

Browse pgsql-cygwin by date

  From Date Subject
Next Message Peter Eisentraut 2003-02-21 19:04:04 Re: database's on a separate partition
Previous Message Jason Tishler 2003-02-21 18:17:33 Re: What could be the cause?