public WaterboxHost(WaterboxOptions opt) { var nativeOpts = new MemoryLayoutTemplate { sbrk_size = Z.UU(opt.SbrkHeapSizeKB * 1024), sealed_size = Z.UU(opt.SealedHeapSizeKB * 1024), invis_size = Z.UU(opt.InvisibleHeapSizeKB * 1024), plain_size = Z.UU(opt.PlainHeapSizeKB * 1024), mmap_size = Z.UU(opt.MmapHeapSizeKB * 1024), }; var moduleName = opt.Filename; var path = Path.Combine(opt.Path, moduleName); var gzpath = path + ".gz"; byte[] data; if (File.Exists(gzpath)) { using var fs = new FileStream(gzpath, FileMode.Open, FileAccess.Read); data = Util.DecompressGzipFile(fs); } else { data = File.ReadAllBytes(path); } var retobj = new ReturnData(); NativeImpl.wbx_create_host(nativeOpts, opt.Filename, Reader(new MemoryStream(data, false)), IntPtr.Zero, retobj); _nativeHost = retobj.GetDataOrThrow(); }
public abstract void wbx_create_host(MemoryLayoutTemplate layout, string moduleName, ReadCallback wbx, IntPtr userdata, ReturnData /*WaterboxHost*/ ret);