Open bbday opened 2 years ago
How many functions are imported?
there are 6 import functions. I put link before to download original wasm
Imports and internal functions get combined into the same index, so if you have 6 imports and 78 internals, the total is 84. 81 is past the 6 imports, so deduct 6 from 81 to get 75, which is the internal function being referenced in that example
I understand maybe i forgot to add import functions reference, is there some small example like import function that return current datetime?
should be like this:
using var stream = File.OpenRead("module.wasm");
var imports = new ImportDictionary
{
{ "env", "time", new FunctionImport(new Func<long>(delegate() { return DateTimeOffset.Now.ToUnixTimeMilliseconds(); } )) },
};
var compiled = Compile.FromBinary<dynamic>(stream!)(imports);
If i try also without import anything i have error: "throw new StackTooSmallException(opcode, 1, stackCount);" (opcode = WebAssembly.OpCode.BranchIf , stackCount = 0)
Thanks.
The import code looks fine, but the StackToSmallException
indicates a problem with the WASM file: it's trying to branch on nothing. There needs to be a 32-bit int on the stack where a non-zero value enters the branch and anything else does not.
I have issue with this wasm link bellow:
on Wasm code it aim to global index 81:
'Index was out of range" there is module.export that say is function index 81 but there are only 78 functions then throw error out of index i dont understand how to fix it
https://1drv.ms/u/s!AulOcG5BxeF6hqEWBbV0rMgcKlKLiw?e=iZeeYE