> 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.
Problem is, it is only at the final linking step that externals are resolved. With the approach above, there will be conflicting externals (same names) from lua51.dll and lua5x.dll. The intermediate static library step does not change that (at least not without some other hackery).
It would really be greatl if Lua had built-in means to support multiple versions in a single executable.