Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

AlwaysRightInstitute/SwiftyWasmerTests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftyWasmer Tests

A Swift API for the Wasmer WebAssembly Runtime.

SwiftyWasmer packages the Wasmer C API for the Swift programming language, i.e. it provides CWasmer system library with a proper module map and a Wasmer module with a nice Swift style API for Wasmer.

Note: This is for embedding/running WebAssembly (Wasm) modules from within a Swift host program. It is not about compiling Swift to WebAssembly (there is the SwiftWasm effort for this).

What does it look like? Like this:

import Wasmer

// Just load a file into memory
let wasmFile = URL(fileURLWithPath: "sum.wasm")
let wasmData = try Data(contentsOf: wasmFile)

// Compile the Data into a module, and instantiate that
let module   = try WebAssembly.Module  (wasmData)
let instance = try WebAssembly.Instance(module)

// Run a function exported by the Module
let results = try instance.exports.sum(.i32(7), .i32(8))

Tests

This package contains the tests for SwiftyWasmer. It is in a separate package because it contains some precompiled Wasm test data that tends to be rather big.

Links

Who

SwiftyWasmer is brought to you by the Always Right Institute and ZeeZide. We like feedback, GitHub stars, cool contract work, presumably any form of praise you can think of.

About

Tests for SwiftyWasmer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages