Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mhmd-azeez/miniz_extism
A small demo of how you can turn a C library into an Extism Plugin
https://github.com/mhmd-azeez/miniz_extism
extism library miniz wasm
Last synced: about 1 month ago
JSON representation
A small demo of how you can turn a C library into an Extism Plugin
- Host: GitHub
- URL: https://github.com/mhmd-azeez/miniz_extism
- Owner: mhmd-azeez
- Created: 2024-03-13T16:52:07.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-13T18:01:49.000Z (9 months ago)
- Last Synced: 2024-10-24T16:18:17.270Z (about 2 months ago)
- Topics: extism, library, miniz, wasm
- Language: C
- Homepage: https://extism.org
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# miniz for Extism
This repo shows how you can convert a normal C library to an Extism Plugin. [miniz](https://github.com/richgel999/miniz) is a minimal compression library.
## Try it out
1. Fetch all submodules
```
git submodule update --init --recursive
```2. Download WASI SDK
```
cd dependencies/extism-pdk
./install-wasi-sdk.sh
```This downloads WASI SDK to `dependencies/extism-pdk/wasi-sdk`.
3. Build
```
cd plugin
mkdir build
cd build
cmake cmake -D CMAKE_C_COMPILER=$(pwd)/../../dependencies/extism-pdk/wasi-sdk/bin/clang ..
make
```Now you should be able to find a `miniz_extism.wasm` in `plugin/build`.
4. Test
```
cd host
go run .
```You should get an output similar to this:
```
PS D:\x\wasm\miniz_extism\host> go run .
Original data: Hello, World! Hello, World! Hello, World! Hello, World! Hello, World!
Original data len: 69
Compressed data len: 39
Decompressed data: Hello, World! Hello, World! Hello, World! Hello, World! Hello, World!
```## Demo