Functions in PostgreSQL under Windows

From: "Artur Plawiak" <apl(at)ite(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: Functions in PostgreSQL under Windows
Date: 2001-05-16 13:14:57
Message-ID: 9dtr1g$mf4$1@news.tpi.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a function written in C that works well in PostgreSQL under Linux
but I have to move it into PostgreSQL under Windows NT.
I made dll with it by doing followed steps :

1) I added new function at the end of file
int WINAPI mydll_init(HANDLE h, DWORD reason, void *foo)
{
return 1;
}

2) I wrote def file
LIBRARY MYCOMMIT
DESCRIPTION 'MYCOMMIT'
HEAPSIZE 10240
EXPORTS
mycommit @2

3) I made dll using instructions :
gcc -I/usr/src/postgresql-7.0.3/src/include/ -I/usr/src/postgresql-7.0.3/src
/backend/ -shared -c mycommit.c -o mycommit.o
gcc -s -Wl,--base-file,mycommit.base -L/usr/local/pgsql/lib/ -shared -o
mycommit.dll mycommit.o -Wl,-e,_mydll_init(at)12 -lpostgres
dlltool --base-file mycommit.base --def mycommit.def --output-exp
mycommit.exp --dllname mycommit.dll
gcc -s -Wl,--base-file,mycommit.base,mycommit.exp -L/usr/local/pgsql/lib/ -o
mycommit.dll mycommit.o -Wl,-e,_mydll_init(at)12 -lpostgres
dlltool --base-file mycommit.base --def mycommit.def --output-exp
mycommit.exp --dllname mycommit.dll
gcc -Wl,mycommit.exp -o mycommit.dll -L/usr/local/pgsql/lib/
mycommit.o -Wl,-e,_mydll_init(at)12 -lpostgres
dlltool --def mycommit.def --dllname mycommit.dll --output-lib mycommit.a

Next I created function in database with instruction :
CREATE FUNCTION mycommit(text) RETURNS int AS
'/home/administrator/dbfunction/mycommit.a' LANGUAGE 'c';

When I tried to invoke that function followed error eccured :
ERROR: Load of file /home/administrator/dbfunction/mycommit.a failed:
dlopen: Win32 error 193

What is wrong ?

Artur
apl(at)ite(dot)pl

Browse pgsql-general by date

  From Date Subject
Next Message Muhammad Rusydi 2001-05-16 13:31:52 grant user...HELP...
Previous Message Nils Zonneveld 2001-05-16 12:56:44 Re: Queries across multiple databases (was: SELECT from a table in another database).