For context, I'm using GitHub - ajrcarey/pdfium-render: A high-level idiomatic Rust wrapper around Pdfium, the C++ PDF library used by the Google Chromium project. in a wasm project, and it currently does interop with a precompiled emscripten-based c++ module via js and copying memory between memory spaces.
I have some rust code I'm looking to compile to wasm32-unknown-unknown via bindgen. And there's an externally compiled c++ module compiled to wasm via emscripten. Previous things I've found on this all said that it couldn't be done because of the ABI incompatibility in the wasm32-unknown-unknown target.
There's now a way to make the wasm32-unknown-unknown target ABI compatible (Status of rust+C bindings for wasm targets · Issue #291 · rustwasm/team · GitHub) , and so I'm wondering what steps I would need to take to link the two modules together and run them in a single memory space.
One hurdle I can think of is that they use different allocators. But I have access to the C++ code, so I could write functions to expose the allocator it uses, then on the rust side of thing define a global allocator that expects those c++ method to be exposed, right?
Another hurdle might be PIC and absolute vs relative memory addresses, but I don't really know much about it and only have heard about it.
Am I way off the mark here? Or if I'm close, is there anything I'm missing?