fix(libextism): namespace ExtismValType (#715)

Some of the old constants conflicted with Perl headers used for build
Perl extensions such the
[perl-sdk](002e4437ac/Extism/lib/Extism/XS.xs).
This fix would allow removing the copy of extism.h (inlined in that file
linked) out of the perl-sdk.

These constants especially `I32` likely have conflicts with many other
large C codebases.

A new extism release with this fix should not be made until the affected
sdks (cpp-sdk) have an update ready.
This commit is contained in:
Gavin Hayes
2024-05-20 11:58:04 -04:00
committed by GitHub
parent 5373f7d88d
commit 75e92c40a0
3 changed files with 10 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ fn main() {
#define EXTISM_SUCCESS 0
/** An alias for I64 to signify an Extism pointer */
#define PTR I64
#define EXTISM_PTR ExtismValType_I64
";
if let Ok(x) = cbindgen::Builder::new()
.with_crate(".")

View File

@@ -10,7 +10,7 @@
#define EXTISM_SUCCESS 0
/** An alias for I64 to signify an Extism pointer */
#define PTR I64
#define EXTISM_PTR ExtismValType_I64
/**
@@ -20,31 +20,31 @@ typedef enum {
/**
* Signed 32 bit integer.
*/
I32,
ExtismValType_I32,
/**
* Signed 64 bit integer.
*/
I64,
ExtismValType_I64,
/**
* Floating point 32 bit integer.
*/
F32,
ExtismValType_F32,
/**
* Floating point 64 bit integer.
*/
F64,
ExtismValType_F64,
/**
* A 128 bit number.
*/
V128,
ExtismValType_V128,
/**
* A reference to a Wasm function.
*/
FuncRef,
ExtismValType_FuncRef,
/**
* A reference to opaque data in the Wasm instance.
*/
ExternRef,
ExtismValType_ExternRef,
} ExtismValType;
/**

View File

@@ -4,6 +4,7 @@ use wasmtime::Caller;
use crate::{error, trace, CurrentPlugin, Error};
/// An enumeration of all possible value types in WebAssembly.
/// cbindgen:prefix-with-name
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
#[repr(C)]
pub enum ValType {