eip1962
eip1962 copied to clipboard
Use libc c_char strings to unblock builds for Arm64
Use libc c_char references to defer to the platform char implementation rather than using signed char (i8).
This allows us to build on Arm64 platforms where char is unsigned.
ref:
https://stackoverflow.com/questions/47684111/make-string-type-compatible-with-arm/47684200 https://users.rust-lang.org/t/expected-const-i8-found-const-u8-for-c-function-pointer-waiting-for-a-const-char/2441 https://github.com/remacs/remacs/issues/1393 etc.
Otherwise arm64 gets build errors such as:
...
error[E0308]: mismatched types
--> src/public_interface/eip196/c_api.rs:58:73
|
58 | let err_out_i8: &mut [i8] = unsafe { std::slice::from_raw_parts_mut(err, EIP196_PREALLOCATE_FOR_ERROR_BYTES) };
| ^^^ expected `i8`, found `u8`
|
= note: expected raw pointer `*mut i8`
found raw pointer `*mut u8`
...
Built and tested on Arm64 linux and x86_64 linux
@shamatar when you have time would you 👀 ? TIA
Oh, that slipped off from my radar. Can you hide libc under feature flag, as it's not required unless there are EIP related features?