Skip site navigation (1) Skip section navigation (2)

Error building external plugin

From: Shachar Shemesh <psql(at)shemesh(dot)biz>
To: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Error building external plugin
Date: 2004-12-27 20:29:48
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers-win32
Hi list,

First of all, please CC me on replies, as I am not subscribed to this list.

I am trying to build a plugin library to be run alongside postgresql. I 
have installed MSys and Mingw, and managed to compile postgresql (rc2, 
configured without zlib support). I did not install it, but rather used 
the binary install from the pginstaller project.

I then take my plugin library (an implementation of the utinyint type), 
and run the following commands (reverse engineered from the usual 
postgresql build process):

gcc -I$PGSRC/src/include -I$PGSRC/src/include/port/win32 tinyint.c -c -o 
dlltool --export-all --output-def libmssql.def tinyint.o 
dlltool --dllname libmssql.dll --def libmssql.def --output-lib libmssql.a
dlltool --dllname libmssql.dll --output-exp libmssql.exp --def libmssql.def
gcc -o libmssql.dll -Wl,--base-file,libmssql.base libmssql.exp tinyint.o 

I'm not sure why the following two lines are necessary, but as that's 
the process that postgres.exe goes through, I did them as well. They do 
not matter as far as my problem is concerned:
dlltool --dllname libmssql.dll --base-file libmssql.base --output-exp 
libmssql.exp --def libmssql.def
gcc -o libmssql.dll libmssql.exp tinyint.o $PGSRC/src/backend/libpostgres.a

When this process is done, I get a compiled libmssql.dll, which I place 
at c:\program files\postgresql\8.0.0-rc2\lib. I then create a new 
database, and run the following command:

create function utinyintin( cstring ) returns utinyint AS 'libmssql', 

The result is this:

ERROR:  unrecognized API version 6646896 reported by info function 

Any help in understanding where this is going wrong would be greatly 
appreciated. Could this be some difference between building from source 
and the binary installation used? If so, what do I need to do 
differently in order to make it work?

Attached is the source for tinyint.c

Many thanks,


Shachar Shemesh
Lingnu Open Source Consulting ltd.

Attachment: tinyint.c
Description: text/x-csrc (4.9 KB)

pgsql-hackers-win32 by date

Next:From: Nicolas COUSSEMACQDate: 2004-12-28 14:13:27
Subject: Re: Fwd: 8.0 Beta3 worked, RC1 didn't!
Previous:From: Magnus HaganderDate: 2004-12-27 18:53:19
Subject: Re: Fwd: 8.0 Beta3 worked, RC1 didn't!

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group