X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 455B19DCBC0 for ; Wed, 21 Dec 2005 06:01:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 92201-03 for ; Wed, 21 Dec 2005 06:01:08 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mx.laposte.net (mx.laposte.net [81.255.54.11]) by postgresql.org (Postfix) with ESMTP id 307419DCBB0 for ; Wed, 21 Dec 2005 06:01:05 -0400 (AST) Received: from [192.168.2.101] (82.240.84.48) by mx.laposte.net (7.2.060.1) (authenticated as ah.pgsql) id 43A8441B000A7937 for pgsql-admin@postgresql.org; Wed, 21 Dec 2005 11:01:07 +0100 Message-ID: <43A927E0.8090503@laposte.net> Date: Wed, 21 Dec 2005 11:01:04 +0100 From: Armel HERVE User-Agent: Thunderbird 1.5 (Windows/20051025) MIME-Version: 1.0 CC: pgsql-admin@postgresql.org Subject: Re: Custom types for a Windows server References: <43A921C1.4050600@laposte.net> In-Reply-To: <43A921C1.4050600@laposte.net> Content-Type: multipart/alternative; boundary="------------030605000605050007050402" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=3.867 required=5 tests=[AWL=-0.475, DNS_FROM_SECURITYSAGE=2.001, HTML_MESSAGE=0.001, MISSING_HEADERS=0.189, RCVD_IN_WHOIS_INVALID=2.151] X-Spam-Score: 3.867 X-Spam-Level: *** X-Archive-Number: 200512/237 X-Sequence-Number: 19957 This is a multi-part message in MIME format. --------------030605000605050007050402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------030605000605050007050402 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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

--------------030605000605050007050402--