asterius
asterius copied to clipboard
Exported static Haskell function is not exposed when built with ahc-cabal
Describe the bug A clear and concise description of what the bug is.
When building with ahc-cabal + ahc-dist, it seems that exported from Haskell aren't populated in the Asterius instance. When building with ahc-link they are exposed.
To Reproduce Steps to reproduce the behavior.
- Take the
js-ffi
test from/asterius/tests/
and convert it into a Cabal project - Build with
ahs-cabal build
and link+run withahc-dist --input-exe <path-to-cabal-executable>/jsffi --input-mjs jsffi.mjs --export-function=mult_hs_int --export-function=mult_hs_double --export-function=putchar --run
-
TypeError: e.exports.mult_hs_int is not a function
Alternatively, linking with ahc-link
in exactly the same command (except of course input-hs jsffi.hs
) will work properly.
This also occurs with the browser. Here is a gist with this test set up.
Expected behavior A clear and concise description of what you expected to happen.
Both ahc-dist and ahc-link expose Haskell functions to JS.
Environment
- OS name + version: MacOS Mojave 10.14.2
- Version of the code: Asterius docker image 018c2194f998 (June 16, 2020, from terrorjack/asterius)
Additional context Add any other context about the problem here.
Thinking that it may be a dead code issue I've also tried this with --no-gc-sections
and --extra-root-symbol=...
to no avail. I think that I've read most of the documentation about exporting Haskell functions chasing this bug by now, am I missing something?
Any updates on this one?