File tree 6 files changed +20
-4
lines changed
6 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Revision history for extism
2
2
3
+ ## 1.2.1.0 -- 2024-04-22
4
+
5
+ * Added ` newFunction `
6
+
3
7
## 1.0.0.0 -- 2024-01-08
4
8
5
9
* Extism 1.0 compatible release
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ hello currPlugin msg = do
18
18
main = do
19
19
setLogFile " stdout" LogError
20
20
let m = manifest [wasmFile " wasm/code-functions.wasm" ]
21
- f <- hostFunction " hello_world" [ptr] [ptr] hello " Hello, again"
21
+ f <- newFunction " hello_world" [ptr] [ptr] " Hello, again" hello
22
22
plugin <- unwrap <$> newPlugin m [f] True
23
23
id <- pluginID plugin
24
24
print id
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ hello currPlugin msg = do
118
118
119
119
main = do
120
120
setLogFile " stdout" LogError
121
- f <- hostFunction " hello_world" [ptr] [ptr] hello " Hello, again"
121
+ f <- newFunction " hello_world" [ptr] [ptr] " Hello, again" hello
122
122
plugin <- unwrap <$> newPlugin m [f] True
123
123
id <- pluginID plugin
124
124
print id
Original file line number Diff line number Diff line change 1
1
cabal-version : 3.0
2
2
name : extism
3
- version : 1.2.0.4
3
+ version : 1.2.1.0
4
4
license : BSD-3-Clause
5
5
6
6
author : Extism authors
Original file line number Diff line number Diff line change 1
1
cabal-version : 3.0
2
2
name : extism-manifest
3
- version : 1.2.0.4
3
+ version : 1.2.1.0
4
4
license : BSD-3-Clause
5
5
6
6
author : Extism authors
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ module Extism.HostFunction
29
29
fromF64 ,
30
30
hostFunction ,
31
31
hostFunction' ,
32
+ newFunction ,
33
+ newFunction' ,
32
34
input ,
33
35
output ,
34
36
getParams ,
@@ -233,3 +235,13 @@ hostFunction = hostFunctionWithNamespace' Nothing
233
235
-- | 'Function' in the provided namespace that can be called from a 'Plugin'
234
236
hostFunction' :: String -> String -> [ValType ] -> [ValType ] -> (CurrentPlugin -> a -> IO () ) -> a -> IO Function
235
237
hostFunction' ns = hostFunctionWithNamespace' (Just ns)
238
+
239
+ -- | 'newFunction "function_name" inputTypes outputTypes callback userData' creates a new
240
+ -- | 'Function' in the default namespace that can be called from a 'Plugin'
241
+ newFunction :: String -> [ValType ] -> [ValType ] -> a -> (CurrentPlugin -> a -> IO () ) -> IO Function
242
+ newFunction name params results x f = hostFunctionWithNamespace' Nothing name params results f x
243
+
244
+ -- | 'newFunction' "namespace" "function_name" inputTypes outputTypes callback userData' creates a new
245
+ -- | 'Function' in the provided namespace that can be called from a 'Plugin'
246
+ newFunction' :: String -> String -> [ValType ] -> [ValType ] -> a -> (CurrentPlugin -> a -> IO () ) -> IO Function
247
+ newFunction' ns name params results x f = hostFunctionWithNamespace' (Just ns) name params results f x
You can’t perform that action at this time.
0 commit comments