diff --git a/c/Makefile b/c/Makefile index f44d91f..75eef4d 100644 --- a/c/Makefile +++ b/c/Makefile @@ -1,2 +1,2 @@ build: - clang -o main main.c -lextism -L . \ No newline at end of file + clang -g -o main main.c -lextism -L . \ No newline at end of file diff --git a/c/main.c b/c/main.c index 40ba0ee..6b6bb87 100644 --- a/c/main.c +++ b/c/main.c @@ -9,9 +9,9 @@ #include #include -void hello_world(ExtismCurrentPlugin *plugin, const struct ExtismVal *inputs, - uint64_t n_inputs, struct ExtismVal *outputs, - uint64_t n_outputs, void *data) { +void hello_world(ExtismCurrentPlugin *plugin, const ExtismVal *inputs, + uint64_t n_inputs, ExtismVal *outputs, uint64_t n_outputs, + void *data) { puts("Hello from C!"); puts(data); @@ -61,7 +61,8 @@ int main(int argc, char *argv[]) { ExtismValType outputs[] = {I64}; ExtismFunction *f = extism_function_new("hello_world", inputs, 1, outputs, 1, hello_world, "Hello, again!", NULL); - ExtismPlugin plugin = extism_plugin_new(ctx, data, len, &f, 1, true); + ExtismPlugin plugin = + extism_plugin_new(ctx, data, len, (const ExtismFunction **)&f, 1, true); free(data); if (plugin < 0) { puts(extism_error(ctx, -1)); diff --git a/node/example.js b/node/example.js index 2ca1774..3414b84 100644 --- a/node/example.js +++ b/node/example.js @@ -42,5 +42,5 @@ withContext(async function (context) { // or, use a context like this: // let ctx = new Context(); // let wasm = readFileSync("../wasm/code.wasm"); -// let p = ctx.plugin(wasm, wasi = true); +// let p = ctx.plugin(wasm); // ... where the context can be passed around to various functions etc. diff --git a/runtime/src/memory.rs b/runtime/src/memory.rs index f22face..b39b8f3 100644 --- a/runtime/src/memory.rs +++ b/runtime/src/memory.rs @@ -173,7 +173,7 @@ impl PluginMemory { pages_needed = 1 } - info!("Requesting {pages_needed} more pages"); + debug!("Requesting {pages_needed} more pages"); // This will fail if we've already allocated the maximum amount of memory allowed self.memory.grow(&mut self.store, pages_needed)?; } @@ -183,7 +183,7 @@ impl PluginMemory { length: n, }; - info!( + debug!( "Allocated new block: {} bytes at offset {}", mem.length, mem.offset ); @@ -202,7 +202,7 @@ impl PluginMemory { /// Free the block allocated at `offset` pub fn free(&mut self, offset: usize) { - info!("Freeing block at {offset}"); + debug!("Freeing block at {offset}"); if let Some(length) = self.live_blocks.remove(&offset) { self.free.push(MemoryBlock { offset, length }); } else { diff --git a/runtime/src/plugin.rs b/runtime/src/plugin.rs index 40c729c..4c4a881 100644 --- a/runtime/src/plugin.rs +++ b/runtime/src/plugin.rs @@ -356,7 +356,7 @@ impl Runtime { &[Val::I32(0), Val::I32(0)], results.as_mut_slice(), )?; - info!("Initialized Haskell language runtime"); + debug!("Initialized Haskell language runtime"); } } Ok(()) @@ -370,7 +370,7 @@ impl Runtime { let mut results = vec![Val::null(); cleanup.ty(&plugin.memory.store).results().len()]; cleanup.call(&mut plugin.memory.store, &[], results.as_mut_slice())?; - info!("Cleaned up Haskell language runtime"); + debug!("Cleaned up Haskell language runtime"); } } diff --git a/runtime/src/sdk.rs b/runtime/src/sdk.rs index 32b355a..aa3e177 100644 --- a/runtime/src/sdk.rs +++ b/runtime/src/sdk.rs @@ -331,7 +331,7 @@ pub unsafe extern "C" fn extism_plugin_update( ctx.plugins .insert(index, std::cell::UnsafeCell::new(plugin)); - info!("Plugin updated: {index}"); + debug!("Plugin updated: {index}"); true } diff --git a/wasm/code-functions.wasm b/wasm/code-functions.wasm index 2d3004c..8301227 100755 Binary files a/wasm/code-functions.wasm and b/wasm/code-functions.wasm differ