Closed uncomputable closed 6 months ago
I was able to replace stdio.h with stddef.h in #207. Assertions are still a problem. Maybe we can define our own assertions like libsecp. We still have to tell the compiler that certain paths are unreachable, or it will fire errors.
Standard assertions don't cause paths to be unreachable. It should be fine to replace C assertions with our own.
The bigger issue will be eliminating calls to malloc
which is far easier in libsecp than in simplicity.
the use of stdio.h
is probably a holdover from when I was using the FILE
interface. Please make a PR to replace it with stddef.h
As far as the C FFI goes, jets are not allowed to do malloc
, so there should be no problem with compling the jets to WASM?
Great observation @roconnor-blockstream. Depending how stupid our compiler is, we may need to do some preprocessor hacking to just cut out all the non-jet C code. (I think right now we build the entire C/
tree of the simplicity lib.)
I intended to have the C Makefile produce a static library for the jets, but I didn't have any actual consumers for such an artefact so I haven't bothered implementing it.
I added a separate jet target to the Makefile: #215
Fixed by #222
The current C code cannot be compiled for WASM, which prevents Simplicity to be run in the browser. rust-simplicity depends on C FFI, so it has the same problem. For comparison, libsecp can be compiled.
We have to remove incompatible standard library headers. So far it looks like these headers cause problems: