Commit Graph

16 Commits

Author SHA1 Message Date
Benjamin Eckel
85b3aece6f Add version to Host SDK and all clients 2022-10-17 09:25:22 -05:00
zach
87be73570d Add ExtismContext to SDK + better errors for failed register/update (#19)
- Adds `ExtismContext` instead of global `PLUGINS` registry
- Adds `extism_context_new`, `extism_context_free` and
`extism_context_reset`
- Requires updating nearly every SDK function to add context parameter
- Renames some SDK functions to follow better naming conventions
   - `extism_plugin_register` -> `extism_plugin_new`
   - `extism_output_get` -> `extism_plugin_output_data`
   - `extism_output_length` -> `extism_plugin_output_length`
   - `extism_call` -> `extism_plugin_call`
- Updates `extism_error` to return the context error when -1 issued for
the plug-in ID
- Adds `extism_plugin_free` to remove an existing plugin
- Updates SDKs to include these functions
- Updates SDK examples and comments

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-20 14:53:15 -06:00
zach
8bc608d1e9 feat: access input/output buffers directly (#11)
This PR updates `extism_output_get` to return an actual pointer to the
output value (`const uint8_t* extism_output_get(PluginIndex plugin)`
instead of `void extism_output_get(PluginIndex plugin, uint8_t *buffer,
uint64_t length)`), this pointer will only be valid until the next call,
but it makes it possible to access the output data without copying.

The input buffer is also not copied and the same issue applies: 
the input buffer must not change during `call`.

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-12 09:34:50 -06:00
zach
7b27d4f883 feat: add extism_plugin_update (#6)
This gives host the ability to re-use plugin descriptors instead of
loading a new plugin each time. The plugin memory and everything is
reset, so no state is shared with the newly loaded plugin.

Co-authored-by: Steve Manuel <steve@dylib.so>
2022-09-09 00:39:57 -06:00
Steve Manuel
63ff9da8dc chore: remove runtime target, work on php release 2022-09-01 22:13:46 -06:00
Steve Manuel
263864e629 chore: prep php example to use composer 2022-09-01 20:38:12 -06:00
Steve Manuel
bd3de24218 chore: prepare repo for php packagist release 2022-09-01 19:53:31 -06:00
Steve Manuel
9ad77a5b60 fix: remove old comment in php sdk 2022-09-01 16:58:47 -06:00
Steve Manuel
d4d8192807 feat: working php sdk and example 2022-09-01 16:41:13 -06:00
Steve Manuel
cb340209fc chore: ignore generated php class, expect to be generated on the fly 2022-08-31 14:33:48 -06:00
Steve Manuel
5cf9bf3843 feat: generate php class from header 2022-08-31 14:33:14 -06:00
Steve Manuel
4b2117a568 fix: variable name typo 2022-08-31 14:11:23 -06:00
Steve Manuel
d7f9b35ffe feat: add generate php script and test the generated class 2022-08-31 13:32:00 -06:00
Steve Manuel
f7dd9515fc feat: add ffime library as dep 2022-08-31 13:31:22 -06:00
zach
58134bcfe7 fix: avoid segfault when using memcpy 2022-08-31 08:05:42 -07:00
Steve Manuel
44eb541932 feat: initial partial php sdk 2022-08-31 01:18:43 -06:00