Re: Cygwin and C triggers

Поиск
Список
Период
Сортировка
От Alan Clucas
Тема Re: Cygwin and C triggers
Дата
Msg-id 3E4CB26A.2080307@pipstechnology.co.uk
обсуждение исходный текст
Ответ на Cygwin and C triggers  (Alan Clucas <alanc@pipstechnology.co.uk>)
Список pgsql-novice
Alan Clucas wrote:
> I am trying to create a simple trigger for postgres under cygwin in C. I
> have followed the examples but I still can't get anything to load.
>
> I am using current cygwin compiled postgresql with the sources installed
> for their headerfiles, under Windows XP with SP1 (not that it should
> matter). Postgresql thinks it's version 7.3.1-1.
>
> Trying to compile one of the demonstration files (refint) in
> C:\cygwin\usr\src\postgresql-7.3.1-1\contrib\spi\
>
> 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>
>
> 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. So I have also tried loading the .o (unlinked files) to which
> I get
>
> jtms=# CREATE FUNCTION check_primary_key() RETURNS TRIGGER AS
> '/usr/src/postgresql-7.3.1-1/contrib/spi/refint.o' LANGUAGE C;
> ERROR:  Load of file /usr/src/postgresql-7.3.1-1/contrib/spi/refint.o
> failed: dlopen: Win32 error 193
>
> I presume this is because refint.o isn't a libary, so this is just me
> being silly. I'm really stuck now, and the search engines are fed up
> with me trying to find the answer.
>
> Oh - and:
>
> $ gcc -v
> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
> Configured with: /netrel/src/gcc-3.2-3/configure
> --enable-languages=c,c++,f77,ja
> va --enable-libgcj --enable-threads=posix --with-system-zlib
> --enable-nls --with
> out-included-gettext --enable-interpreter --disable-sjlj-exceptions
> --disable-ve
> rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux
> --host=i686-pc
> -cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr
> --exec-prefix=/usr
> --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include
> --libexecd
> ir=/usr/sbin
> Thread model: posix
> gcc version 3.2 20020927 (prerelease)

Tried downgrading gcc to:
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-5/specs
gcc version 2.95.3-5 (cygwin special)

But still get the problems. Someone must have seen this - please help
me! It must be something really stupid, but I'm don't know what.

Alan


В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Weaver
Дата:
Сообщение: Re: [SQL] Passing arrays
Следующее
От: list DB
Дата:
Сообщение: change year in timestamp