|
|
|
|
|
by moefh
1528 days ago
|
|
This is really cool! I never looked into WASM before, I'm really happy to see it's not that difficult to build a simple example like this. One thing that's bothering me about that code is the declaration of `memory` as an uint8_t when it's clearly being used for its address: extern uint8_t memory;
And then in a lot of places: uint8_t* ptr = &memory;
ptr[FOO] = BAR;
Declaring `memory` as an array is much more idiomatic C, and generates the exact same assembly: extern uint8_t memory[];
And then memory[FOO] = BAR;
I just tested it, and it seems to work exactly as one would expect from a plain C linker (so there's no WASM magic I can see). Am I missing something? |
|
Thank you to the author though! It is a nice little example.