Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Mon Aug 9 03:46:00 GMT 2010

On Sun, 2010-08-08 at 10:35 +0200, Václav Haisman wrote:
> Is it not undefined in Cygwin because Windows cannot support the behaviour?
> AFAIK once you do LoadLibrary(A.dll) then any subsequent reference to A.dll
> and its exports will be satisfied from the already loaded A.dll. IOW, Windows
> cannot satisfy "The object's symbols shall not be made available for the
> relocation processing of any other object," as specified by [2].

Remember that Cygwin's dlopen() does nothing with the second argument,
so none of RTLD_* actually affect behaviour.  According to your logic,
we shouldn't define one of RTLD_LAZY or RTLD_NOW, because they can't
both be true, so our dlopen() isn't fulfilling its meaning.  We define
both anyway, and I don't see this as any different.

Secondly, on Linux, RTLD_LOCAL is essentially the default, so lots
(most?) software intended primarily for Linux which passes neither it
nor RTLD_GLOBAL is probably expecting RTLD_LOCAL behaviour anyway.
Therefore actually defining RTLD_LOCAL isn't a notable change.

Thirdly, several times I have seen the following:

#ifndef RTLD_LOCAL
#define RTLD_LOCAL 0

So they're clearly not too concerned about specific behaviour, they just
don't require RTLD_GLOBAL and therefore specify the opposite.  Defining
RTLD_LOCAL ourselves just saves us from patching this in to other


More information about the Cygwin-patches mailing list