Shared library issue in Windows - Mailing list pgsql-bugs

From Mehul Doshi-A20614
Subject Shared library issue in Windows
Date
Msg-id F12CE1A68F023D498A2691C7B53931155B6241@ZMY16EXM66.ds.mot.com
Whole thread Raw
List pgsql-bugs
=20
Hi,

This is a reposting of my email from win32 hackers list.
Original Issue:
http://archives.postgresql.org/pgsql-hackers-win32/2006-01/msg00000.php

Below I have given the exact scenario which I can replicate in three
different systems. Anybody who has faced this kind of issue please let
me know if you have a way to get the psql to be able to use the
dynamic_library_path right away.

Also I think the documentation at
http://www.postgresql.org/docs/8.1/static/runtime-config-client.html
should show \\ instead of \ for Windows environment=20
e.g dynamic_library_path =3D
'C:\\tools\\postgresql;H:\\my_project\\lib;$libdir'

Thanks & Regards,
Mehul

-----Original Message-----
From: Mehul Doshi-A20614=20
Sent: Friday, January 27, 2006 11:45 AM
To: Magnus Hagander; pgsql-hackers-win32@postgresql.org
Cc: Mehul Doshi-A20614
Subject: RE: [pgsql-hackers-win32] Query on support for trigger
functions defined in a Shared library in Windows


Hi,

Here's a weird scenario that seems to be coming out of so many different
options.
a) When the dll is placed in C:\Program Files\PostgreSQL\8.0\bin it
works.
b) When the dll is placed in C:\Program Files\Test\lib, it fails if
dynamic_library_path is set to 'C:\Program Files\Test\lib;$libdir'

However I had help from two people on this,
i) Jean Marc: Replace \ with / i.e dynamic_library_path is set to
'C:/Program Files/Test/lib;$libdir'
ii) Thomas Hallgreen: Do \\ instead of just \. i.e. dynamic_library_path
is set to 'C:\\Program Files\\Test\\lib;$libdir'

Now both of these "start to" work after some time only. There is no
logic that I can explain as to how they work.
Here's what I have tried to do to understand this behavior.=20

a) Uninstall postgres completely and delete the data folder.
b) Re-install Postgres.
c) Modify the postgresql.conf file with either of the methods. I used
method (ii) since it is more Windows like.
d) Modify the System Variable PATH to contain the extra term "C:\Program
Files\Test\lib"
d) Now I stop the service, start the service. I even rebooted my system.
e) On a new command prompt, I test it out ... Error as before. I can
verify the PATH variable does have C:\Program Files\Test\lib in it.
f) Anyways since I can't do much, I go back and add the dll to the bin
folder and start using it.
g) I can now go back to first command prompt and retest it starts to
work!!!. It works with libdir.
i)I can also go back and modify and delete the dll file that I placed in
the bin folder.
j) I can again retest the dll and it works fine.=20

Infact it starts to take the dynamic path perfectly.=20
test=3D# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS
trigger
test-#   AS 'testrigfuncs'
test-#   LANGUAGE C ;
CREATE FUNCTION
test=3D# \q

I have tried this on 4 different systems running Windows XP (Service
Packs 1 & 2) using PostgreSQL 8.0 as well as PostgreSQL 8.1.
Any clues as to why it won't work till I placed the dll in
Postgresql\bin folder and then once I have placed the dll there and used
it, it starts to work at either places even if I delete the dll from the
bin folder.

Thanks & Regards,
Mehul

pgsql-bugs by date:

Previous
From: Philipp Reisner
Date:
Subject: Endless loop in ExecNestLoop
Next
From: Tom Lane
Date:
Subject: Re: Endless loop in ExecNestLoop