A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/shareup/cwasm3 below:

GitHub - shareup/cwasm3

CWasm3 packages the Wasm3 library inside of a Swift package. The original Wasm3 header and implementation files are unchanged, but CWasm3 does add some additional conveniences to allow for receiving the return values from WebAssembly functions instead of having them printed to the console.

CWasm3's releases mirror those of Wasm3 to make it easier to integrate with other projects.

To use CWasm3 with the Swift Package Manager, add a dependency to your Package.swift file:

let package = Package(
  dependencies: [
    .package(name: "CWasm3", url: "https://github.com/shareup/cwasm3.git", .upToNextMinor(from: "0.5.0"))
  ]
)

The best way to learn how to use CWasm3 is to look at the tests in Tests/CWasm3Tests/CWasm3Tests.swift.

That being said, this is how you can create an instance of the Wasm3 runtime and load a Wasm module into it:

let environment = m3_NewEnvironment()
defer { m3_FreeEnvironment(environment) }

let runtime = m3_NewRuntime(environment, 512, nil)
defer { m3_FreeRuntime(runtime) }

let wasmBytes = ...
var module: IM3Module?
m3_ParseModule(environment, &module, wasmBytes, UInt32(wasmBytes.count))
m3_LoadModule(runtime, module)

The license for CWasm3 is the standard MIT license. You can find it in the LICENSE file.

The license for Wasm3 is also the standard MIT license. You can find it here.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4