Closed Fordi closed 1 year ago
Just a version mismatch; v0.0.20 doesn't like mvm-bc files created with v0.0.19. Makes sense. Cloning main, using its dist-c files, and using the repo's CLI script in-place instead of the global microvium
from npm fixed the problem:
[Ninja edit: Yay, try/catch works!]
// script.mvm.js
console.log = vmImport(1);
function sayHello() {
try {
console.log('Hello, world!');
throw { message: 'An error' };
} catch (e) {
console.log(`Caught: ${e.message}`);
}
}
vmExport(1234, sayHello);
$ make clean; make && ./main; echo "Exit code: $?"
rm main *.o *.mvm-bc
gcc -c main.c -o main.o
gcc -c microvium.c -o microvium.o
gcc main.o microvium.o -lm -o main
node ../microvium/dist/cli.js script.mvm.js
Output generated: script.mvm-bc
218 bytes
Hello, world!
Caught: An error
Exit code: 0
Starting with what I believe to be the goal of Getting Started, I get no output, and an error code of 18 (MVM_E_INVALID_BYTECODE).
Code attached, running:
microvium-issue-sample.zip
The same test works with the current release code (v0.0.19)