Skip to content
Snippets Groups Projects

Document how to create WASI reactor with user-defined exports

Merged Cheng Shao requested to merge develop into master
1 unresolved thread

Merge request reports

Approval is optional

Merged by Cheng ShaoCheng Shao 2 years ago (Jan 25, 2023 3:59pm UTC)

Merge details

  • Changes merged into master with 6f0a1cd7.
  • Deleted the source branch.
  • Auto-merge enabled

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • amesgen
  • amesgen
    amesgen @amesgen started a thread on the diff
  • 198 possible to use the `ccall` calling convention for foreign exports.
    199 It's still possible to exchange large values between Haskell and
    200 JavaScript:
    201
    202 - Add `--export` flag for `malloc`/`free`. You can now allocate and
    203 free linear memory buffers that can be visible to the Haskell world,
    204 since the entire linear memory is available as the `memory` export.
    205 - In the Haskell world, you can pass `Ptr` as foreign export
    206 argument/return values.
    207 - You can also use `mallocBytes` in `Foreign.Marshal.Alloc` to
    208 allocate buffers in the Haskell world. A buffer allocated by
    209 `mallocBytes` in Haskell can be passed to JavaScript and be freed by
    210 the exported `free`, and vice versa.
    211
    212 Now you can create and manage C buffers, you can create and pass the
    213 correct `argc`/`argv` if you want `getArgs`/`getProgName` to work.
    • Comment on lines +212 to +213

      What about providing an example of this here? This would involve en/decoding strings, how to copy JS buffers (Uint8Array) to/from the WASM memory, which would probably already answer a lot of questions.

    • Of course! Will add more concrete examples of buffer exchanging.

    • Apologies for not adding buffer exchanging example yet, given there's not enough time. Planning to do that in subsequent MRs.

    • Please register or sign in to reply
  • amesgen
  • amesgen
  • amesgen
  • Cheng Shao added 1 commit
  • Cheng Shao added 1 commit

    added 1 commit

    • 19fdb0f7 - Rename BIGNUM_BACKEND to FLAVOUR

    Compare with previous version

  • Cheng Shao added 5 commits

    added 5 commits

    • b68c84c3 - Bump
    • ca885bc5 - Rename BIGNUM_BACKEND to FLAVOUR
    • 11cefeaf - Emit stage1 cflags in the env file
    • 3ebdf24b - Add unix/ormolu-live to integration test
    • 656d5e0b - Add how to create wasi reactor with user-defined exports to readme

    Compare with previous version

  • amesgen
  • Cheng Shao added 5 commits

    added 5 commits

    • 1eaa039a - Bump
    • 625962bc - Rename BIGNUM_BACKEND to FLAVOUR
    • 7b777c44 - Emit stage1 cflags in the env file
    • 084ae19f - Add unix/ormolu-live to integration test
    • a0403384 - Add how to create wasi reactor with user-defined exports to readme

    Compare with previous version

  • Cheng Shao enabled an automatic merge when the pipeline for a0403384 succeeds

    enabled an automatic merge when the pipeline for a0403384 succeeds

  • merged

  • Cheng Shao mentioned in commit 6f0a1cd7

    mentioned in commit 6f0a1cd7

  • Please register or sign in to reply
    Loading