New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust bindings #39
Comments
I'll take a stab at that over the next few days. 😄 |
@Veykril FYI the project now uses CMake library structure. |
Ah great, I'll see if I can make use of it. |
I got a small question regarding the Would be great if you could let me know whether this would be possible. I wouldn't mind being the one to do the change either in that case 😄 |
@soundandform any objections? |
Seems okay. The interpreter does use these as well: the trap conditions. The interpreter return type needs to remain as-is. But it's probably fine to cast the enum to a fake pointer in those cases. |
Why exactly do the traps have to stay pointers? Aren't all traps checked by pointer equality anyways? I don't quite see where the problem would arise from moving those to the enum as well. |
Yes. I'm saying make them enums as well. But when you do that work, you will find that the exec portion of the code is what returns the traps. Without going into deep discussion of how the interpreter works at this moment, this return type must remain a pointer. So, you'll have to do some enum to pointer casting and back. |
@Veykril let me know if you need any help |
Tried making the changes in #76. Also I think understood what Steven meant, I assume it was about the |
Reflecting on this more, I don't see value in enumerating every error message for this library. These error messages are largely intended for humans, not the machine. Largely, there are just two cases: success (Wasm code is cool) and fail (Wasm code is bogus). This should be easy to distinguish in the foreign language: null-pointer or not null-pointer, which can be casted to a bool in C before the interface, if necessary. The only fined-grain compare and switch I see in our own code thus far is I use C-strings for errors because I've spent a lifetime looking at useless error dialogs on stupid-crashy software. |
Mmh, ye thats actually a good point, given its only failure or success it's really not necessary. It would probably do more harm than good in the end I agree. I'll close the PR then. 😄 |
Thanks @Veykril. The |
Implement Rust bindings, so
wasm3
can be easily used from Rust.The text was updated successfully, but these errors were encountered: