tweag / libffi-wasm32

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libffi-wasm32

Limited port of libffi to pure wasm32.

Limitations compared to vanilla libffi

  • Function argument count is capped to 4
  • For each function type, closure count is capped to 16. Both constants can be tuned, and exceptions can be made for specific function types
  • Closure API is modified, closure alloc/prep is done in a single call
  • No support for structures or variadic functions yet

How to use

This is a Haskell cabal project, simply run the libffi-wasm32 executable. It'll generate additional C sources in cbits. Then include stuff in cbits for your own usage.

The generated cbits are also available as CI artifacts.

How?

See this blog post for details.

About


Languages

Language:Haskell 66.6%Language:C 32.2%Language:Shell 1.2%