Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement without C dependency #15

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
uses: actions/setup-go@v3
with:
cache: true
go-version: '1.20'
go-version: '1.21.1'

- name: Install TinyGo
uses: acifani/setup-tinygo@v1.1.0
with:
tinygo-version: 0.28.1
binaryen-version: "110"
tinygo-version: 0.30.0
binaryen-version: "116"

- name: Compile example
run: |
Expand Down
76 changes: 76 additions & 0 deletions env.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package pdk

type extismPointer uint64

//go:wasmimport env extism_input_length
func extism_input_length() uint64

//go:wasmimport env extism_length
func extism_length(extismPointer) uint64

//go:wasmimport env extism_alloc
func extism_alloc(uint64) extismPointer

//go:wasmimport env extism_free
func extism_free(extismPointer)

//go:wasmimport env extism_input_load_u8
func extism_input_load_u8_(extismPointer) uint32

func extism_input_load_u8(p extismPointer) uint8 {
return uint8(extism_input_load_u8_(p))
}

//go:wasmimport env extism_input_load_u64
func extism_input_load_u64(extismPointer) uint64

//go:wasmimport env extism_output_set
func extism_output_set(extismPointer, uint64)

//go:wasmimport env extism_error_set
func extism_error_set(extismPointer)

//go:wasmimport env extism_config_get
func extism_config_get(extismPointer) extismPointer

//go:wasmimport env extism_var_get
func extism_var_get(extismPointer) extismPointer

//go:wasmimport env extism_var_set
func extism_var_set(extismPointer, extismPointer)

//go:wasmimport env extism_store_u8
func extism_store_u8_(extismPointer, uint32)
func extism_store_u8(p extismPointer, v uint8) {
extism_store_u8_(p, uint32(v))
}

//go:wasmimport env extism_load_u8
func extism_load_u8_(extismPointer) uint32
func extism_load_u8(p extismPointer) uint8 {
return uint8(extism_load_u8_(p))
}

//go:wasmimport env extism_store_u64
func extism_store_u64(extismPointer, uint64)

//go:wasmimport env extism_load_u64
func extism_load_u64(extismPointer) uint64

//go:wasmimport env extism_http_request
func extism_http_request(extismPointer, extismPointer) extismPointer

//go:wasmimport env extism_http_status_code
func extism_http_status_code() int32

//go:wasmimport env extism_log_info
func extism_log_info(extismPointer)

//go:wasmimport env extism_log_debug
func extism_log_debug(extismPointer)

//go:wasmimport env extism_log_warn
func extism_log_warn(extismPointer)

//go:wasmimport env extism_log_error
func extism_log_error(extismPointer)
Binary file modified example/example.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion example/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/extism/go-pdk/example

go 1.19
go 1.21.0

require github.com/extism/go-pdk v0.0.0-20220910220145-f385a5f19d1d

Expand Down
Binary file modified example/http.wasm
Binary file not shown.
111 changes: 0 additions & 111 deletions extism-pdk.h

This file was deleted.

Loading
Loading