Skip to content

SuperTails/wasmcraft-newlib-example

Repository files navigation

Wasmcraft + Newlib

This example is part of the Wasmcraft Suite. See the link for more details on the project.

Most software one would want to compile using Wasmcraft is not freestanding, i.e. it needs resources and functions provided by an operating system. For example, printf and malloc are provided by the C standard library, and so are not available by default.

This project demonstrates how to include the newlib C standard library implementation in a project so that Wasmcraft code can use the C standard library.

Layout

main.c

This contains code that uses functions like printf, open, and malloc to demonstrate that the standard library is usable and works properly.

stubs.c

This contains the glue code that allows newlib to work in Minecraft. It is divided into a few sections which can be modified to work with various different programs.

Usage

To build the example, run build.sh. This will generate newlib_example.wasm and newlib_example.wat.

newlib_example.wasm can then be used in Wasmcraft directly or in the simulator to see the results.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published