Re: postgres.h

From: Jason Tishler <jason(at)tishler(dot)net>
To: Nupur Pande <npande(at)vt(dot)edu>
Cc: pgsql-cygwin(at)postgresql(dot)org
Subject: Re: postgres.h
Date: 2003-11-05 16:06:20
Message-ID: 20031105160619.GD1792@tishler.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin

Nupar,

On Tue, Nov 04, 2003 at 01:28:06PM -0500, Nupur Pande wrote:
> Thanks a lot..

You are welcome.

> that did work.

Good.

> Did I do something wrong?

Yes and no.

> I'm trying to create a .so file. My makefile looks like this:
^^^

Under Cygwin (i.e., Windows), you should create .dll files instead.

> all: RuleFinder.so
>
> RuleFinder.so: RuleFinder.o
> gcc -shared -o RuleFinder.so RuleFinder.o
>
> RuleFinder.o: <files>
> gcc -I /usr/include/postgresql/server -fpic -c RuleFinder.c
^^^^^

The -fpic options is unnecessary under Cygwin.

> gcc -shared -o RuleFinder.so RuleFinder.o
> RuleFinder.o(.text+0x16c1):RuleFinder.c: undefined reference to `_SPI_exec'
> [snip]

You are missing the "-lpostgres" option (and possibly the associated
"-L" option too) on the link command line. Unfortunately, the binary
package does *not* contain libpostgres.a. This is because the other
Unix platforms do not have such a file. Sigh...

The short-term workaround is to download the PostgreSQL source and build
libpostgres.a yourself. I need to think about the long-term solution...

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

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Jason Tishler 2003-11-05 16:10:36 Re: postgres.h
Previous Message Themistoklis Konstantinou 2003-11-05 15:16:08 Double messages!