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: 41D070BC.5040604@shemesh.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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
tinyint.o
dlltool --export-all --output-def libmssql.def tinyint.o
$PGSRC/src/backend/libpostgres.a
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
$PGSRC/src/backend/libpostgres.a

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',
'utinyintin' LANGUAGE C IMMUTABLE STRICT;

The result is this:

ERROR: unrecognized API version 6646896 reported by info function
"pg_finfo_utinyintin"

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

--
Shachar Shemesh
Lingnu Open Source Consulting ltd.
http://www.lingnu.com/

Attachment Content-Type Size
tinyint.c text/x-csrc 4.9 KB

Browse pgsql-hackers-win32 by date

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