rust-diplomat / diplomat

Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code
https://rust-diplomat.github.io/book/
Other
480 stars 45 forks source link

JS2 Backend: Is there a way we can verify the argument positions of our functions? #528

Open ambiguousname opened 1 week ago

ambiguousname commented 1 week ago

For web assembly, it's somewhat difficult to verify that the function signature Diplomat calls will be what the .wasm file wants.

Rust offers a way to view the LLVM IR output for any project: https://rustc-dev-guide.rust-lang.org/backend/debugging.html#get-your-hands-on-raw-llvm-input

This isn't a surefire way to guarantee that we will produce the correct code every time, but we could use this during tests to verify accuracy.

The ideal solution would be finding which project/associated documentation generates the LLVM signatures we're looking for. It probably involves looking at Rust's compiler/asking people involved with that project what's going on there.