Re: Query on support for trigger functions - Mailing list pgsql-hackers-win32

From Mehul Doshi-A20614
Subject Re: Query on support for trigger functions
Date
Msg-id 45AAAAED8B10F547878F52FE15C57C5D15D04A@zin24exm03.corp.mot.com
Whole thread Raw
List pgsql-hackers-win32
Hi Magnus,

Thanks. Here's what I did:
1. Downloaded the 8.0 source code.
2. Created a test directory in postgresql-8.0.0\src\
3. Wrote a  sample c snippet as given below:
4. Compiled using gcc (version 3.4.4) in cygwin
5. Used the following make file to generate the dll.

----------------------------------------------------------------------------
-------

# Makefile to build test DLL
subdir = src/test
top_builddir = ../..

NAME = test
SO_MAJOR_VERSION = 1
SO_MINOR_VERSION = 0
SHLIB_LINK = $(filter -lintl, $(LIBS)) $(BE_DLLLIBS) -lpcre

SRCS = test.c trigger_test_funcs.c
OBJS = $(SRCS:.c=.o)

include $(top_builddir)/src/Makefile.global
include $(top_builddir)/src/Makefile.shlib

MYCFLAGS = -ansi
MYINCLUDES = -I../include

all: all-lib

%.o: %.c

$(CC) -c $(MYCFLAGS) $(MYINCLUDES) $<

clean:

rm -f $(OBJS) $(NAME).dll

# TODO: dependencies

----------------------------------------------------------------------------
-------

What do I need to do to make it work?

Please let me know.

Thanks & Regards,
Mehul


-----Original Message-----
From: Magnus Hagander [mailto:mha@sollentuna.net]
Sent: Monday, July 25, 2005 8:45 PM
To: Mehul Doshi-A20614; pgsql-hackers-win32@postgresql.org
Subject: RE: [pgsql-hackers-win32] Query on support for trigger functions
defined in a Shared library in Windows


> Hi,
>
> I would like to know whether the native Windows version of
> PostgreSQL (version 8.0.0) supports trigger functions defined
> in shared libraries. Specifically, I am trying to port a
> Linux shared object used as the snippet below shows to Windows:
>
> CREATE FUNCTION foo() returns trigger AS
> '/path/to/sharedlib.so' LANGUAGE C;
>
> Are DLLs supported in a similar context in Windows?

Yes, they should be.


> What do I need to do to port such code?

Most functions should work without modifications.


> My initial attempts resulted in a failure. I created the DLL
> and attempted to run the SQL CREATE FUNCTION which specified
> the Windows path to the DLL. However the server died without
> any clueful messages.

How exactly did you build your DLL?

//Magnus

pgsql-hackers-win32 by date:

Previous
From: "Michael GUIARD"
Date:
Subject: libpq request results
Next
From: "Magnus Hagander"
Date:
Subject: Re: Query on support for trigger functions defined in a Shared library in Windows