Skip site navigation (1) Skip section navigation (2)

Shared library issue in Windows

From: "Mehul Doshi-A20614" <mehul(at)motorola(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Cc: "Mehul Doshi-A20614" <mehul(at)motorola(dot)com>
Subject: Shared library issue in Windows
Date: 2006-01-30 16:34:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs

This is a reposting of my email from win32 hackers list.
Original Issue:

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
should show \\ instead of \ for Windows environment 
e.g dynamic_library_path =

Thanks & Regards,

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


Here's a weird scenario that seems to be coming out of so many different
a) When the dll is placed in C:\Program Files\PostgreSQL\8.0\bin it
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. 

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
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. 

Infact it starts to take the dynamic path perfectly. 
test=# CREATE OR REPLACE FUNCTION trigf_test_pid_insert() RETURNS
test-#   AS 'testrigfuncs'
test-#   LANGUAGE C ;
test=# \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,

pgsql-bugs by date

Next:From: Tom LaneDate: 2006-01-30 16:42:57
Subject: Re: Endless loop in ExecNestLoop
Previous:From: Tom LaneDate: 2006-01-30 15:19:48
Subject: Re: BUG #2224: unlogical syntax error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group