Closed miraclx closed 1 year ago
But thinking about this a bit more, couldn't we avoid Rust ABI entirely and load this with libloading::Symbol<extern "C" fn() -> String>
instead? We would have to change the way SDK exposes the symbol obviously, but that should not be a big deal.
@itegulov, yeah I came to the same conclusion, but to be safe, we can replace String
entirely with *const c_char
Hmm, weird. Have you tried it? I am getting an empty file instead of ABI.
Yeah, it works. Although, for posterity, the empty file issue was fixed in https://github.com/near/cargo-near/pull/75.
This patch requires a version of near-sdk
that uses near-abi v0.2.0
. So we'll have to merge #55 before this.
CI fails for this reason. https://github.com/near/cargo-near/actions/runs/3281321184/jobs/5403176360#step:4:1081
@itegulov, this is ready. What do you think? Can you test it out?
@miraclx hmm weird it is not working for me. Tried our classic adder
example and got this:
Have you tried cleaning your target folder? Maybe cargo is returning an artifact from previous builds? In the meantime, I'll spin up a Linux machine and see if I can reproduce this.
@miraclx yep, sorry, must have had some leftover artifacts indeed. Works fine now!
You got it, chief!
Fixes #61, alternative to #73, depends on a small patch to SDK – https://github.com/near/near-sdk-rs/pull/939.