Skip to Content
WebAssembly: The Definitive Guide
book

WebAssembly: The Definitive Guide

by Brian Sletten
December 2021
Intermediate to advanced content levelIntermediate to advanced
332 pages
8h 36m
English
O'Reilly Media, Inc.
Book available
Content preview from WebAssembly: The Definitive Guide

Chapter 3. WebAssembly Modules

A place for everything and everything in its place.

Seventeenth-century proverb

An operating system runs a program usually contained in a compiled form.1 Each operating system has its own format that defines where to start, what data is necessary, and what the instructions are for the different advertised bits of functionality. WebAssembly is no different. In this chapter, we are going to look at how the behavior is packaged up and how a host will know what to do with it.

It is possible that software engineers can spend their entire careers ignoring how programs are loaded and executed through this process. Their world starts and stops at int main(int argc, char **argv) or static void main(String []args) or even if __name__ == "__main__":. These are well-known entry points to programs in C, Java, and Python, thus this is where programmers assume responsibility for the control flow. Prior to programs being launched and after they exit, however, the operating system or programmatic runtime needs to set up and tear down the executable structure. The loader process needs to know where the instructions begin, how data elements are initialized, what other modules or libraries need to be loaded, and more.

These details are generally defined by the nature of the executable. On Linux, this is defined by the Executable and Linkable Format (ELF); on Windows, it’s the Portable Executable (PE) format; and on macOS, it is the Mach-O format. These are obviously ...

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

gRPC: Up and Running

gRPC: Up and Running

Kasun Indrasiri, Danesh Kuruppu
Real-World Next.js

Real-World Next.js

Michele Riva
Microservices Patterns

Microservices Patterns

Chris Richardson

Publisher Resources

ISBN: 9781492089834Errata Page