Skip to Main Content
Understand the Need for WebAssembly Components
shortcut

Understand the Need for WebAssembly Components

by Brian Sletten
May 2024
5 pages
8m
English
O'Reilly Media, Inc.
Content preview from Understand the Need for WebAssembly Components

Understand the Need for WebAssembly Components

In the “Use wasm-tools to Investigate and Manipulate WebAssembly Artifacts” Shortcut, I introduced you to the wasm-tools collection of functionality. It is similar to the WebAssembly Binary Toolkit but is a more modern suite of tools that reflects how the standards have evolved. I indicated that there was a new artifact type called a component, in addition to our friend the module. In this Shortcut, I am going to explain the need for the WebAssembly Component Model before introducing it in a subsequent Shortcut.

In the GitHub repository for this Shortcut, you should enter the directory 21-Why-Wasm-Components. In it you will find a readme.md file describing the installation instructions for the tools, so you can follow along. There are also a handful of files you have seen before that we will again explore.

This Shortcut is, in some sense, a pause and review activity. The larger purpose is to highlight the perhaps not obvious arc linking the topics we have covered, with an eye toward where we are going. Most of the Shortcuts stand on their own, but together they are telling a very big story.

In the Shortcut I mentioned above, I used a .wat-based expression of some simple arithmetic and showed how wasm-tools helps us explore the module structure. Let’s now revisit the higher-level expression of our add function in Rust in add.rs:

#[no_mangle] pub extern "C" fn add(x: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Reinventing the Organization for GenAI and LLMs

Reinventing the Organization for GenAI and LLMs

Ethan Mollick

Publisher Resources

ISBN: 9781098172121