Giter VIP home page Giter VIP logo

extism-c-pdk's Introduction

Use Extism PDK for С to send HTTP(s) requests from inside WASM

This devcontainer is configured to provide you a wasi-sdk 20.0.

Open in GitHub Codespaces

Instructions for this devcontainer

Preparation

  1. Open this repo in devcontainer, e.g. using Github Codespaces. Type or copy/paste following commands to devcontainer's terminal.

  2. Download the extism-pdk.h header file, the only required part of Extism C PDK:

wget https://raw.githubusercontent.com/extism/c-pdk/main/extism-pdk.h

Building

  1. Compile the example:
clang -o HTTPRequestingPlugin.wasm -mexec-model=reactor httpget.c

Test with Extism CLI

For testing purposes, you can invoke functions from Extism plugins with Extism CLI.

  1. Install Extism CLI from Github releases:
wget https://github.com/extism/cli/releases/download/v0.3.4/extism-v0.3.4-linux-amd64.tar.gz
tar -xzf extism-v0.3.4-linux-amd64.tar.gz

And now you have extism binary in current folder.

  1. Run httpget function from extism plugin with CLI, allowing outbound connections to all hosts:
./extism call HTTPRequestingPlugin.wasm httpget --allow-host '*' --wasi

Finish

Perform your own experiments if desired.


This devcontainer is based on ideas from dev-wasm/dev-wasm-c.

Created for (wannabe-awesome) list

extism-c-pdk's People

Contributors

vasilev avatar

Stargazers

 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.