diff options
Diffstat (limited to '')
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | bench/ffi/plus100/plus100.bun.js | 4 | ||||
| -rw-r--r-- | bench/ffi/plus100/plus100.deno.js | 4 | ||||
| -rw-r--r-- | bench/ffi/plus100/plus100.napi.mjs | 4 | ||||
| -rw-r--r-- | types/bun/ffi.d.ts | 10 | 
5 files changed, 22 insertions, 2 deletions
| @@ -1828,7 +1828,7 @@ const out = encode_png(  );  ``` -The [generated wrapper](https://github.com/Jarred-Sumner/bun/blob/c6d732eee2721cd6191672cbe2c57fb17c3fffe4/src/javascript/jsc/ffi.exports.js#L146-L148) will automatically convert the pointer to a TypedArray. +The [auto-generated wrapper](https://github.com/Jarred-Sumner/bun/blob/c6d732eee2721cd6191672cbe2c57fb17c3fffe4/src/javascript/jsc/ffi.exports.js#L146-L148) converts the pointer to a TypedArray  <details> diff --git a/bench/ffi/plus100/plus100.bun.js b/bench/ffi/plus100/plus100.bun.js index 3ddaff975..3eb4de02e 100644 --- a/bench/ffi/plus100/plus100.bun.js +++ b/bench/ffi/plus100/plus100.bun.js @@ -28,3 +28,7 @@ bench("noop() ", () => {  // prevents gc and can help with jit optimizing out functions  await run({ collect: false, percentiles: true });  console.log("\n"); + +if (plus100(1) !== 101) { +  throw new Error("plus100(1) !== 101"); +} diff --git a/bench/ffi/plus100/plus100.deno.js b/bench/ffi/plus100/plus100.deno.js index 83e4fc317..ec58a8b64 100644 --- a/bench/ffi/plus100/plus100.deno.js +++ b/bench/ffi/plus100/plus100.deno.js @@ -24,3 +24,7 @@ bench("noop() ", () => {  // collect option collects benchmark returned values into array  // prevents gc and can help with jit optimizing out functions  await run({ collect: false, percentiles: true }); + +if (plus100(1) !== 101) { +  throw new Error("plus100(1) !== 101"); +} diff --git a/bench/ffi/plus100/plus100.napi.mjs b/bench/ffi/plus100/plus100.napi.mjs index aa8d2636f..2b3015933 100644 --- a/bench/ffi/plus100/plus100.napi.mjs +++ b/bench/ffi/plus100/plus100.napi.mjs @@ -14,3 +14,7 @@ bench("noop() ", () => {  });  await run({ collect: false, percentiles: true });  console.log("\n"); + +if (plus100(1) !== 101) { +  throw new Error("plus100(1) !== 101"); +} diff --git a/types/bun/ffi.d.ts b/types/bun/ffi.d.ts index 67cbfb593..96f6fa562 100644 --- a/types/bun/ffi.d.ts +++ b/types/bun/ffi.d.ts @@ -416,7 +416,15 @@ declare module "bun:ffi" {    // export function callback(ffi: FFIFunction, cb: Function): number;    export interface Library { -    symbols: Record<string, CallableFunction>; +    symbols: Record< +      string, +      CallableFunction & { +        /** +         * The function without a wrapper +         */ +        native: CallableFunction; +      } +    >;      /**       * `dlclose` the library, unloading the symbols and freeing allocated memory. | 
