OS X import bug?

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Jan 25 04:57:24 EST 2002


Manoj Plakal <terabaap at yumpee.org> writes:

> Is there some OS X linker option one can give
> while building the extension such that
> the symbols in baz.c are exposed to
> foomodule.c while building module foo,
> but these baz symbols are not exposed
> outside module foo? Would the
> "two-level namespace" as opposed
> to the flat namespace be of use here?

Might be. On Linux (and other SysV systems), Python uses RTLD_LOCAL
when loading extensions. This means essentially that one extension
cannot see any symbols of a different extension. This is by design:
Python extensions ought to have separate namespaces.

I'm not even sure why flat_namespace is used on OS X. I understood it
to avoid the problem of duplicate symbols, whereas it appears that it
is precisely *not* the intent of this approach, and that two-level
namespaces are meant to be used for applications like Python.

On Windows, there are only two-level namespaces; each symbol is
referenced by DLL name and symbol name. Unfortunately, since the main
application does not have a DLL name, you need a pythonXY.dll to
provide the core Python symbols to each extension.

Regards,
Martin



More information about the Python-list mailing list