Re: Query on support for trigger functions

From: Mehul Doshi-A20614 <mehul(at)motorola(dot)com>
To: "'Magnus Hagander'" <mha(at)sollentuna(dot)net>, pgsql-hackers-win32(at)postgresql(dot)org
Cc: Mehul Doshi-A20614 <mehul(at)motorola(dot)com>
Subject: Re: Query on support for trigger functions
Date: 2005-07-26 12:56:36
Message-ID: 45AAAAED8B10F547878F52FE15C57C5D15D04A@zin24exm03.corp.mot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sollentuna(dot)net]
Sent: Monday, July 25, 2005 8:45 PM
To: Mehul Doshi-A20614; pgsql-hackers-win32(at)postgresql(dot)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

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Magnus Hagander 2005-07-26 12:58:18 Re: Query on support for trigger functions defined in a Shared library in Windows
Previous Message Michael GUIARD 2005-07-26 08:46:36 libpq request results