mirror of
https://github.com/extism/extism.git
synced 2026-01-11 14:58:01 -05:00
Compare commits
7 Commits
stable
...
symlink-pl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5db12e667 | ||
|
|
5b58cd2580 | ||
|
|
890760f06d | ||
|
|
d29e9f8f93 | ||
|
|
52cc95bf5a | ||
|
|
4b5796b92b | ||
|
|
fee2f03651 |
1
go/code-functions.wasm
Symbolic link
1
go/code-functions.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../wasm/code-functions.wasm
|
||||
@@ -46,7 +46,7 @@ func main() {
|
||||
} else {
|
||||
data = []byte("testing from go -> wasm shared memory...")
|
||||
}
|
||||
manifest := extism.Manifest{Wasm: []extism.Wasm{extism.WasmFile{Path: "../wasm/code-functions.wasm"}}}
|
||||
manifest := extism.Manifest{Wasm: []extism.Wasm{extism.WasmFile{Path: "code-functions.wasm"}}}
|
||||
f := extism.NewFunction("hello_world", []extism.ValType{extism.I64}, []extism.ValType{extism.I64}, C.hello_world, "Hello again!")
|
||||
defer f.Free()
|
||||
plugin, err := ctx.PluginFromManifest(manifest, []extism.Function{f}, true)
|
||||
|
||||
@@ -8,7 +8,7 @@ unwrap (Left (ExtismError msg)) = do
|
||||
error msg
|
||||
|
||||
main = do
|
||||
let m = manifest [wasmFile "../wasm/code.wasm"]
|
||||
let m = manifest [wasmFile "code.wasm"]
|
||||
context <- Extism.newContext
|
||||
plugin <- unwrap <$> Extism.pluginFromManifest context m False
|
||||
res <- unwrap <$> Extism.call plugin "count_vowels" (Extism.toByteString "this is a test")
|
||||
|
||||
1
haskell/code.wasm
Symbolic link
1
haskell/code.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../wasm/code.wasm
|
||||
1
node/code-functions.wasm
Symbolic link
1
node/code-functions.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../wasm/code-functions.wasm
|
||||
@@ -24,7 +24,7 @@ let hello_world = new HostFunction(
|
||||
let functions = [hello_world];
|
||||
|
||||
withContext(async function (context) {
|
||||
let wasm = readFileSync("../wasm/code-functions.wasm");
|
||||
let wasm = readFileSync("code-functions.wasm");
|
||||
let p = context.plugin(wasm, true, functions);
|
||||
|
||||
if (!p.functionExists("count_vowels")) {
|
||||
@@ -39,6 +39,6 @@ withContext(async function (context) {
|
||||
|
||||
// or, use a context like this:
|
||||
// let ctx = new Context();
|
||||
// let wasm = readFileSync("../wasm/code.wasm");
|
||||
// let wasm = readFileSync("code-functions.wasm");
|
||||
// let p = ctx.plugin(wasm);
|
||||
// ... where the context can be passed around to various functions etc.
|
||||
|
||||
Binary file not shown.
1
php/example/code.wasm
Symbolic link
1
php/example/code.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../../wasm/code.wasm
|
||||
@@ -3,16 +3,16 @@
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$ctx = new \Extism\Context();
|
||||
$wasm = file_get_contents("../../wasm/code.wasm");
|
||||
$wasm = file_get_contents("code.wasm");
|
||||
$plugin = new \Extism\Plugin($ctx, $wasm);
|
||||
|
||||
$output = $plugin->call("count_vowels", "this is an example");
|
||||
$json = json_decode(pack('C*', ...$output));
|
||||
echo "Vowels counted = " . $json->{'count'} . PHP_EOL;
|
||||
|
||||
$wasm = file_get_contents("../../wasm/code.wasm");
|
||||
$wasm = file_get_contents("code.wasm");
|
||||
$ok = $plugin->update($wasm);
|
||||
if ($ok) {
|
||||
$id = $plugin->getId();
|
||||
echo "updated plugin: $id";
|
||||
}
|
||||
}
|
||||
|
||||
1
python/code-functions.wasm
Symbolic link
1
python/code-functions.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../wasm/code-functions.wasm
|
||||
1
python/code.wasm
Symbolic link
1
python/code.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../wasm/code.wasm
|
||||
1
ruby/code.wasm
Symbolic link
1
ruby/code.wasm
Symbolic link
@@ -0,0 +1 @@
|
||||
../wasm/code.wasm
|
||||
@@ -7,7 +7,7 @@ require "json"
|
||||
# If you do you can create a context with `Extism#new`, example: `ctx = Extism.new`
|
||||
Extism.with_context do |ctx|
|
||||
manifest = {
|
||||
:wasm => [{ :path => "../wasm/code.wasm" }],
|
||||
:wasm => [{ :path => "code.wasm" }],
|
||||
}
|
||||
|
||||
plugin = ctx.plugin(manifest)
|
||||
|
||||
@@ -27,12 +27,13 @@ Gem::Specification.new do |spec|
|
||||
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
||||
end
|
||||
end
|
||||
spec.files.reject! { |f| f.end_with?(".wasm") }
|
||||
spec.bindir = "exe"
|
||||
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
||||
spec.require_paths = ["lib"]
|
||||
|
||||
# Uncomment to register a new dependency of your gem
|
||||
spec.add_dependency "ffi", ">= 1.0.0"
|
||||
spec.add_dependency "ffi", "~> 1.0"
|
||||
|
||||
# For more information and examples about making a new gem, check out our
|
||||
# guide at: https://bundler.io/guides/creating_gem.html
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user