[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] twoface: a Lua 5.1 style ABI on top of lua52.dll
- From: Peter Cawley <lua@...>
- Date: Sun, 21 Jul 2013 01:21:27 +0100
On Sun, Jul 21, 2013 at 12:48 AM, Paul K <paulclinger@yahoo.com> wrote:
> Yes, I saw Peter's comment, but I'm not familiar with the terminology
> ("non-flat namespaces") to figure out what the implications are and
> quick google search didn't turn much relevant information.
>
> As far as I understand, it implies that it works on Windows only
> because one library (for examples, luasocket) is linked against
> lua51.dll and that library can handle some calls and proxy the rest to
> lua52.dll. "flat namespace" on Linux means that it simply finds a
> symbol without limiting the search to a particular dynamic library
> (this is all based on my very limited understanding).
For each C API function, either you need a 5.1 variant and a 5.2
variant and some logic at library-load time to resolve imports to the
correct variant, or you need a single function which whenever it is
called can know which variant its caller expects it to be and acts
accordingly. With a non-flat namespace, the two-variants approach
becomes simple, as the "fully qualified" name of each C API function
differs between the two variants (that is, lua5.1.dll!lua_getstack and
lua5.2.dll!lua_getstack are two a-priori unrelated functions). With a
flat namespace, you need some heuristics to determine which variant of
the API a consumer is expecting, and you also need some deep linker
hackery to have different consumes receive different variants
depending on the result of this heuristic.