[plt-scheme] ffi: dlopen in unix

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Oct 12 14:46:35 EDT 2006

On Oct 11, Jon Rafkind wrote:
> > RTLD_GLOBAL is not used when you pass in #f -- this passes NULL to
> > dlopen, and no linking of new names is done.
> RTLD_GLOBAL is always used, #f passes in NULL for the name argument
> but I was saying maybe only RTLD_GLOBAL is needed when the name is
> NULL (#f). Perhaps this is not the case as you say below.

I don't think that RTLD_GLOBAL or _LOCAL make any difference in that
case, since no linking is done.

> How about just a 3rd parameter to ffi-lib, 'global or 'local which would
> correspond directly to RTLD_GLOBAL or RTLD_LOCAL?

That would be the obvious solution, but there is already an optional
second argument to the core function (telling it to return #f instead
of an error), and there is also RTLD_NOW that can be controlled by an
option.  Finally, this:

On Oct 11, Hans Oesterholt-Dijkema wrote:
> Would that not break compatibility with e.g. windows?

is another concern.

On Oct 11, Jon Rafkind wrote:
> From the code foreign.c uses and random googling it seems like
> Windows doesn't differentiate between global and local symbols so I
> guess the flag could just be ignored on Windows.

Still, it would be good to know if there is some equivalent for this
on Windows.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.