Call a Wasm function from C
This guide builds a native C host that loads a Wasm module and calls its exported fib function. To compile your own C program into WebAssembly, follow Build a Wasm application in C.
Use WasmEdge Library
When programming with WasmEdge C API, developers should include the required headers and link with the WasmEdge Library. Besides install WasmEdge with the WasmEdge shared library, developers can also build WasmEdge to generate the WasmEdge static library.
Host Functions
Host functions are the functions outside WebAssembly and are passed to WASM modules as imports. The following steps give an example of implementing host functions and registering a host module into the WasmEdge runtime.
Customized External References
External References denotes an opaque and unforgettable reference to a host object. A new externref type can be passed into a WASM module or returned. The WASM module cannot reveal an externref value's bit pattern nor create a fake host reference by an integer value.
Multiple WASM Module Example
For those WASM modules that export their functions, the other WASM modules can import them as a library.
C API reference and upgrades
19 items
Using Plug-ins to Extend the Runtime in C
The WasmEdge plug-ins are the shared libraries to provide the WasmEdge runtime to load and create host module instances. With the plug-ins, the WasmEdge runtime can be extended more easily.