Closed rgbkrk closed 1 year ago
At least as of https://github.com/denoland/deno/commit/be7e2bd8c1883c6bf58db8ff40954ed7ee53b5c5 (and earlier), I can't import and use skia_canvas.
skia_canvas
Example code in ffi_bug.ts:
ffi_bug.ts
import { createCanvas } from "https://deno.land/x/skia_canvas@0.5.4/mod.ts"; const canvas = createCanvas(800, 250);
Running it:
➜ cargo run -- --unstable run --allow-all ffi_bug.ts Compiling semver v1.0.14 Compiling napi_sym v0.50.0 (/Users/kai/code/src/github.com/denoland/deno/cli/napi/sym) Compiling rustc_version v0.4.0 Compiling curve25519-dalek v4.1.1 Compiling x25519-dalek v2.0.0 Compiling deno_node v0.57.0 (/Users/kai/code/src/github.com/denoland/deno/ext/node) Compiling deno_crypto v0.134.0 (/Users/kai/code/src/github.com/denoland/deno/ext/crypto) Compiling deno_kv v0.28.0 (/Users/kai/code/src/github.com/denoland/deno/ext/kv) Compiling deno_runtime v0.128.0 (/Users/kai/code/src/github.com/denoland/deno/runtime) Compiling deno v1.37.1 (/Users/kai/code/src/github.com/denoland/deno/cli) Finished dev [unoptimized + debuginfo] target(s) in 1m 13s Running `target/debug/deno --unstable run --allow-all ffi_bug.ts` error: Uncaught (in promise) TypeError: expected typed ArrayBufferView const METRICS_PTR = Deno.UnsafePointer.of(METRICS); ^ at Function.of (ext:deno_ffi/00_ffi.js:230:23) at https://deno.land/x/skia_canvas@0.5.4/src/context2d.ts:191:40 at eventLoopTick (ext:core/01_core.js:183:11)
Looks like the op -> op2 for ffi work needs to handle more buffer types (https://github.com/denoland/deno/pull/20509).
Closing as the issue is in Deno main and is being worked on.
At least as of https://github.com/denoland/deno/commit/be7e2bd8c1883c6bf58db8ff40954ed7ee53b5c5 (and earlier), I can't import and use
skia_canvas
.Example code in
ffi_bug.ts
:Running it: