GithubHelp home page GithubHelp logo

cwasm3's Introduction

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.

Installation

Swift Package Manager

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"))
  ]
)

Usage

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)

License

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.

cwasm3's People

Contributors

atdrendel avatar filipw avatar myobie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.