Git Product home page Git Product logo

example-wasm-pointer-plugins's Introduction

example-wasm-pointer-plugins

This example project illustrates how to start a WebAssembly (WASM) module as a plugin or extension and transfer information from the WASM module to the parent module. Given that the standard API for WASM only allows the transfer of integers, this project utilizes WASM pointers to facilitate the transfer of information. Steps Involved:

  1. Request Data: Initiate a request for data from the WASM module.
  2. Get WASM Pointer: Obtain a pointer from the WASM module.
  3. Transform WASM Pointer to Regular Pointer: Convert the WASM pointer into a regular pointer that can be used by the parent module.
  4. Read Data Transfer Object (DTO): The DTO holds a pointer to the value we want to read, along with the lenght of the value that is referenced (see definition below).
#[repr(C)]
#[derive(Debug)]
pub struct PluginCollectData {
    pub offset: i32,
    pub len: i32,
}
  1. Read Information from DTO Pointer: Extract the information from the DTO pointer.
  2. Deallocate Data in WASM Memory (Depending on usecase): Depending on the use case, deallocate the data in WASM memory. (Note: This step is not implemented in the current version.)

How to run:

  1. make build to build the three applications
  2. make run to run the App
  3. make clean & make clean-build to remove any created artifacts

References:

This project is inspired by:

example-wasm-pointer-plugins's People

Contributors

leonardpahlke avatar

Stargazers

Christian Bargmann 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.