[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Modify Lua Executable for a -51 option
- From: Sean Conner <sean@...>
- Date: Sun, 29 Apr 2018 16:01:28 -0400
It was thus said that the Great Russell Haley once stated:
> On Sun, Apr 29, 2018 at 4:02 AM, Peter Cawley <lua@corsix.org> wrote:
>
> > On Sun, Apr 29, 2018 at 10:07 AM, Viacheslav Usov <via.usov@gmail.com>
> > wrote:
> > > That only solves part of the problem, because you still need to load the
> > > appropriate DLL dynamically (easy) and make sure that all the API calls
> > by
> > > main51() and main5x(), and the functions called by them,are routed to the
> > > correct DLL. A first step toward that goal would be not linking your
> > > executable against any luazx.dll, then all the API calls will result in
> > > linker errors, giving you a list of API functions used by both versions.
> >
> > Alternatively, you could load both DLLs and just then ignore one of
> > them. Compile the file defining main51, link it against lua51.dll to
> > produce a main51 static library. Compile the file defining main5x,
> > link it against lua5x.dll to produce a main5x static library. Compile
> > a stub main which calls either main51 or main5x, link it against both
> > static libraries to produce an executable. (I _think_ this'll work
> > with static libraries, though if not it'll certainly work if you
> > replace the word "static" with "dynamic" throughout).
> >
> >
> I had a roughly similar thought too (yours is more complete than mine!).
> Thanks for the suggestion.
You are going to have a fun time [1] with Lua modules written in C. You
may even have a fun time [1] with Lua modules written in Lua. There are
probably easier ways to accomplish this without mucking with linkers.
-spc
[1 And by "fun time" I mean an "interesting time" [2]
[2] In the Chinese curse [3] sense of "May you live in interesting times."
[3] Apocraphal, citation needed.