console.log
pitust opened this issue · comments
https://github.com/coder-mike/microvium/blob/master/doc/getting-started.md says console.log and it doesnt work. Did you mean log, which does work?
Welcome! I think you may be the first person to try Microvium out, and certainly the first to contribute an issue!
I think the issue you're seeing is that you're probably using the latest (pre)release on npm, which was released before I had implemented support for object and properties like console.log
. Things have progressed since then I changed it to console.log
to make it more familiar to JS developers. I'll run through the getting-started guide again on my machine just to make sure it all works, and re-publish another (pre)release to npm.
Do you mind me asking, how did you hear about Microvium, since I haven't widely publicized it yet? And what are you considering using it for?
@pitust See if (pre)release 0.0.8 fixes your issue.
I also added a regression test suite which programmatically executes the code in the getting-started.md file to help it from getting out of sync again in future.
There is no "resolveImport"
I'm not familiar with wasm2c. If there's nothing analogous to resolveImport
, then how do you call a C function from TypeScript code? Or, how do you import a function implemented by the host?
You import them in TS like this:
declare function importedFunc(): void;
Then, compiled to wasm, it will be a WASM import:
(type $t0 (func))
(import "main" "importedFunc" (func $main.importedFunc (type $t0)))
which wasm2c will convert into a (mangled) name.
You then create a variable with that name, assign the function poitnter to it, and it will (hopefully) work.
Fixed