Skip to content
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

Wasm support #23

Open
Luthaf opened this issue Mar 4, 2022 · 1 comment
Open

Wasm support #23

Luthaf opened this issue Mar 4, 2022 · 1 comment

Comments

@Luthaf
Copy link
Member

Luthaf commented Mar 4, 2022

Is there any possibility of wasm32-unknown-unknown support at any point down the line?

Originally posted by @Yoshanuikabundi in #22 (comment)

@Luthaf
Copy link
Member Author

Luthaf commented Mar 4, 2022

Moving the discussion to a separate issue since this question is quite complex =)


For context, chemfiles is written in C++, and exposes a C API. This repository contains the Rust FFI binding to the C API.

The C++ code can be compiled to WASM using emscripten, this is the basis for the (unreleased) JS bindings to chemfiles in https://github.com/chemfiles/chemfiles.js.

Unfortunately, there are some difference between the emscripten WASM target and the Rust wasm32-unknown-unknown target, so I don't know if we can use the resulting WASM code together with Rust.

The alternative would be to compile the C++ code without emscripten, maybe using LLVM facilities directly trying to make it as compatible with rustc wasm32-unknown-unknown target as possible. The issue here is that emscripten provides a lot of functionalities (mainly a virtual filesystem giving access to pseudo-files in a browser context), which would have to be replicated with the new compiler

Overall, this is something I would like to enable, but will require a lot of work & knowledge about both WASM & FFI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant