lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Sun, Apr 29, 2018 at 4:02 AM, Peter Cawley <> wrote:
On Sun, Apr 29, 2018 at 10:07 AM, Viacheslav Usov <> 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.