Unix Technical Forum

Re: Compiling UDF DLL under Win32

This is a discussion on Re: Compiling UDF DLL under Win32 within the pgsql Hackers forums, part of the PostgreSQL category; --> > I was wondering if I can use VC compiler to compile UDF DLL ? > If yes then ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 08:56 AM
Magnus Hagander
 
Posts: n/a
Default Re: Compiling UDF DLL under Win32

> I was wondering if I can use VC compiler to compile UDF DLL ?
> If yes then I am wondering why I am getting linking errors:
>
> Compiling...
> fd.c
> Linking...
> Creating library Debug/fd.lib and object Debug/fd.exp
> fd.obj : error LNK2001: unresolved external symbol
> _CurrentMemoryContext Debug/fd.dll : fatal error LNK1120: 1
> unresolved externals
>
>
> It seems that linker is not able to find symbol CurrentMemoryContext.
> This variable is declared in palloc.h, but I can't find the
> implementation of this variable in libpostgres.a ?


No, you need to use mingw to compile extensions.

//Magnus

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 08:56 AM
William ZHANG
 
Posts: n/a
Default Re: Compiling UDF DLL under Win32


""Magnus Hagander"" <mha@sollentuna.net>
> No, you need to use mingw to compile extensions.


I think we should write some documents on how to generate
postgres.lib from postgres.exe for VC++, Borland C++ users.

> //Magnus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 09:00 AM
anonymus.crux
 
Posts: n/a
Default Re: Compiling UDF DLL under Win32

hm, I'm still stuck: can't compile extension with mingw compiler.
I use Dev-CPP IDE (4.9.9.2) with MingW 3.7. Has it been tested to compile
extensions under XP with PostgresQL 8.1.2 ?

Al I get are compiler errors:

gcc.exe -c fd.c -o fd.o -I"C:/Dev-Cpp/include"
-I"D:/.Work/postgresql/postgresql-8.1.2/src/include"
-I"D:/.Work/postgresql/postgresql-8.1.2/src/include/port/win32"
-I"D:/.Work/postgresql/postgresql-8.1.2/src/include"
-I"D:/.Work/postgresql/postgresql-8.1.2/src/include/port/win32"
-DBUILDING_DLL=1 -DWIN32 -DWIN32_CLIENT_ONLY=0

D:/.Work/postgresql/postgresql-8.1.2/src/include/port/win32.h:181:
error: redefinition of typedef 'pid_t'
C:/Dev-Cpp/include/sys/types.h:75: error: previous declaration of
'pid_t' was here

In file included from
D:/.Work/postgresql/postgresql-8.1.2/src/include/postgres.h:48,
from fd.c:8:
D:/.Work/postgresql/postgresql-8.1.2/src/include/c.h:328: error:
redefinition of typedef 'sig_atomic_t'
C:/Dev-Cpp/include/signal.h:46: error: previous declaration of
'sig_atomic_t' was here

In file included from
D:/.Work/postgresql/postgresql-8.1.2/src/include/access/tupdesc.h:18,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/utils/rel.h:17,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/storage/bufmgr.h:21,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/storage/bufpage.h:18,

from
D:/.Work/postgresql/postgresql-8.1.2/src/include/access/htup.h:17,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/utils/tqual.h:18,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/access/relscan.h:18,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/nodes/execnodes.h:17,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/executor/execdesc.h:19,
from
D:/.Work/postgresql/postgresql-8.1.2/src/include/executor/executor.h:17,
from fd.c:10
......
......
......

>>I was wondering if I can use VC compiler to compile UDF DLL ?
>>If yes then I am wondering why I am getting linking errors:
>>
>>Compiling...
>>fd.c
>>Linking...
>> Creating library Debug/fd.lib and object Debug/fd.exp
>>fd.obj : error LNK2001: unresolved external symbol
>>_CurrentMemoryContext Debug/fd.dll : fatal error LNK1120: 1
>>unresolved externals
>>
>>
>>It seems that linker is not able to find symbol CurrentMemoryContext.
>>This variable is declared in palloc.h, but I can't find the
>>implementation of this variable in libpostgres.a ?
>>
>>

>
>No, you need to use mingw to compile extensions.
>
>//Magnus
>
>---------------------------(end of broadcast)---------------------------
>TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
>



---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 09:00 AM
Andrew Dunstan
 
Posts: n/a
Default Re: Compiling UDF DLL under Win32



Are you using pgxs + gmake? That's the best way to set up a UDF. We
recently made changes to ensure that pgxs works on Windows, and several
people have used it.

This could easily blow up on you: -I"C:/Dev-Cpp/include" - why do you
need to use the IDE's include files?

If you really need an IDE or something like it, native Windows XEmacs
works reasonably.

cheers

andrew

anonymus.crux wrote:

> hm, I'm still stuck: can't compile extension with mingw compiler.
> I use Dev-CPP IDE (4.9.9.2) with MingW 3.7. Has it been tested to compile
> extensions under XP with PostgresQL 8.1.2 ?
>
> Al I get are compiler errors:
>
> gcc.exe -c fd.c -o fd.o -I"C:/Dev-Cpp/include"
> -I"D:/.Work/postgresql/postgresql-8.1.2/src/include"
> -I"D:/.Work/postgresql/postgresql-8.1.2/src/include/port/win32"
> -I"D:/.Work/postgresql/postgresql-8.1.2/src/include"
> -I"D:/.Work/postgresql/postgresql-8.1.2/src/include/port/win32"
> -DBUILDING_DLL=1 -DWIN32 -DWIN32_CLIENT_ONLY=0
>
> D:/.Work/postgresql/postgresql-8.1.2/src/include/port/win32.h:181:
> error: redefinition of typedef 'pid_t'
> C:/Dev-Cpp/include/sys/types.h:75: error: previous declaration of
> 'pid_t' was here
>
> In file included from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/postgres.h:48,
> from fd.c:8:
> D:/.Work/postgresql/postgresql-8.1.2/src/include/c.h:328: error:
> redefinition of typedef 'sig_atomic_t'
> C:/Dev-Cpp/include/signal.h:46: error: previous declaration of
> 'sig_atomic_t' was here
>
> In file included from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/access/tupdesc.h:18,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/utils/rel.h:17,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/storage/bufmgr.h:21,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/storage/bufpage.h:18,
>
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/access/htup.h:17,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/utils/tqual.h:18,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/access/relscan.h:18,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/nodes/execnodes.h:17,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/executor/execdesc.h:19,
> from
> D:/.Work/postgresql/postgresql-8.1.2/src/include/executor/executor.h:17,
> from fd.c:10






---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com