I'm having some trouble with trying to make a sensible interface to actually using this library, but I may just be missing something obvious (or, alternatively, have completely missed a key paradigm :P)
Looking at your example copy of your exports-function.php example, we see that although we have an exported function of "sum", it only ever gets referenced by $exports->offsetGet(0), not by Sum.
Compiling the most barebones addition rust program, I end up with something like this:
The only way I can find to reference that function is like so: $addOne = (new Wasm\Extern($exports->offsetGet(1)))->asFunc();
There doesn't seem to be an getByName or similar.
I can iterate through the exports and filter it down to the exports that are only functions, but I haven't had any success at finding any method that will then translate that function to what it's name is.
I'm having some trouble with trying to make a sensible interface to actually using this library, but I may just be missing something obvious (or, alternatively, have completely missed a key paradigm :P)
Looking at your example copy of your exports-function.php example, we see that although we have an exported function of "sum", it only ever gets referenced by
$exports->offsetGet(0)
, not by Sum.Compiling the most barebones addition rust program, I end up with something like this:
The only way I can find to reference that function is like so:
$addOne = (new Wasm\Extern($exports->offsetGet(1)))->asFunc();
There doesn't seem to be an
getByName
or similar.I can iterate through the exports and filter it down to the exports that are only functions, but I haven't had any success at finding any method that will then translate that function to what it's name is.
Thank you!