public static void InitHelper(SymbolResolver engineResolver) { Util.LoadExtenderLibrary("LuaHelper.dll"); var helperModule = Util.GetModule("LuaHelper.dll"); var helperResolver = new ExportResolver(helperModule); var symbols = helperResolver.FindSymbolsMatching(new Regex("lua*")).ToArray(); if (symbols.Length == 0) { throw new UnresolvedSymbolException("Could not find LuaHelper symbols"); } var toSkip = new HashSet <string>() { "luaL_checkudata", "luaL_execresult", "luaL_file" }; var addresses = symbols .Select(name => { engineResolver.TryResolve(name, out var result); return(result); }) .ToArray(); InitProxy(symbols, addresses, symbols.Length); luaopen_package = helperResolver.Resolve("luaopen_package"); luaopen_io = helperResolver.Resolve("luaopen_io"); luaopen_os = helperResolver.Resolve("luaopen_os"); }
void LogEngineSymbols(SymbolResolver engineResolver) { var engineSymbols = engineResolver.FindSymbolsMatching(new Regex("lua*")); File.WriteAllLines("engine_symbols.txt", engineSymbols); Util.LoadExtenderLibrary("LuaHelper.dll"); var helperModule = Util.GetModule("LuaHelper.dll"); var helperResolver = new ExportResolver(helperModule); var symbols = helperResolver.FindSymbolsMatching(new Regex("lua*")); var missingSymbols = symbols. Where(name => !engineResolver.TryResolve(name, out var _)); File.WriteAllLines("missing_symbols.txt", missingSymbols); }