Re: Custom types for a Windows server - Mailing list pgsql-admin

From Armel HERVE
Subject Re: Custom types for a Windows server
Date
Msg-id 43A927E0.8090503@laposte.net
Whole thread Raw
In response to Re: Custom types for a Windows server  (Armel HERVE <ah.pgsql@laposte.net>)
List pgsql-admin
Armel HERVE wrote:
Magnus Hagander wrote:
we made some custom types (written in C)  for PostgreSQL onto 
a Linux server.
We need to deploy a Windows server...

The documentation does not talk about a shared library for Windows
(http://www.postgresql.org/docs/8.1/interactive/xfunc-c.html#DFUNC)
I tried to compile its custom types with borland bcc32, with 
no success:

Does somebody can help me ?
   
You need to compile the functions using MingW GCC.

//Magnus
 
Thanks again for your answers.
Now, when I try to generate the shared library by the following command:
gcc -shared -o pstypes.dll -Wl,-dy,--library-path,/c/Program\ Files/PostgreSQL/8.1/lib/,-l,libpq.a,--out-implib,pstypes.a country.o

the compiler response is:
c:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -llibpq.a
collect2: ld returned 1 exit status

but the libpq.a is in the lib repository of PostgresSQL...

I tried to link with the libpq.dll located in the bin repository, the response is the same: cannot find -llibpq.dll

Armel

In fact, the true command is
gcc -shared -o pstypes.dll -Wl,--library-path=/c/Program\ Files/PostgreSQL/8.1/lib/,-l,pgport,-lpostgres,--out-implib,pstypes.a country.o

and the response is
Creating library file: pstypes.a
country.o(.text+0x2e):country.c: undefined reference to `elog_start'
country.o(.text+0x49):country.c: undefined reference to `elog_finish'
country.o(.text+0xb0):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0xba):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0xf4):country.c: undefined reference to `elog_start'
country.o(.text+0x10f):country.c: undefined reference to `elog_finish'
country.o(.text+0x13d):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x147):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x1b0):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x1ba):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x205):country.c: undefined reference to `pfree'
country.o(.text+0x241):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x24b):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x280):country.c: undefined reference to `pfree'
country.o(.text+0x2eb):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x2f5):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x33f):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x349):country.c: undefined reference to `MemoryContextAlloc'
collect2: ld returned 1 exit status

I tried to link with all found library with no success...

Armel

pgsql-admin by date:

Previous
From: Armel HERVE
Date:
Subject: Re: Custom types for a Windows server
Next
From: Jonathan Parkin
Date:
Subject: Re: PostgreSQL 7.4.10 hanging on delete