Re: backend process terminates - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: backend process terminates
Date
Msg-id 20070808084713.GA27465@svana.org
Whole thread Raw
In response to Re: backend process terminates  (Geoffrey <lists@serioustechnology.com>)
Responses Re: backend process terminates  (Geoffrey <lists@serioustechnology.com>)
List pgsql-general
On Tue, Aug 07, 2007 at 07:46:45AM -0400, Geoffrey wrote:
> I don't know all the idiosyncrasies of how this works, so bear with me
> on this.  The developer at the vendor indicated that he's narrowed down
> the problem to a set of wrapper routines in their code.  They are named
> OpenFile(), CloseFile() and ReadFile();  He inquired as to whether there
> might be routines in the Postgresql code with the same names that might
> be causing a conflict.  Sure enough, I searched the Postgresql source
> code and found routines with the same names.  I don't see how this could
> pose a problem though, as it is my understanding that the compiler will
> properly address this issue.

Yes, this could cause a problem. In general, when loading a library,
any external references are first resolved against the main
executable, then already loaded libraries, then the library being
loaded. It's all in the ELF standard, if you're interested.

As for solutions:
1. In your third party library, have the library built in such a way
that the symbols are explicitly bound to the internal library version.
There are various methods for dealing with that, it all depends on the
toolchain used to build it. I suppose this product is actually several
libraries that call eachother? Namespace would help here.

2. Make sure that any externally visible symbols in libraries are
always prefixed by a tag, like libpq does (almost all symbols are pq*).

Running "nm -D" over the main postgres executable and your libraries
should give you an idea of the scope of the problem.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: "Harald Armin Massa"
Date:
Subject: Comment for column in view - "legal" or just working?
Next
From: Dave Page
Date:
Subject: Re: Comment for column in view - "legal" or just working?