From b1a6555c0502196174bed1454e446717daf52f12 Mon Sep 17 00:00:00 2001 From: Aapo Alasuutari Date: Fri, 18 Feb 2022 14:21:19 +0200 Subject: feat(ext/ffi): Support read only global statics (#13662) --- test_ffi/tests/test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test_ffi/tests/test.js') diff --git a/test_ffi/tests/test.js b/test_ffi/tests/test.js index a9681ab9f..943f86ae8 100644 --- a/test_ffi/tests/test.js +++ b/test_ffi/tests/test.js @@ -73,6 +73,12 @@ const dylib = Deno.dlopen(libPath, { parameters: [], result: "pointer", }, + "static_u32": { + type: "u32", + }, + "static_ptr": { + type: "pointer", + }, }); dylib.symbols.printSomething(); @@ -201,6 +207,14 @@ dylib.symbols.sleep_nonblocking(100).then(() => { console.log("Before"); console.log(performance.now() - start < 100); +console.log("Static u32:", dylib.symbols.static_u32); +console.log( + "Static ptr:", + dylib.symbols.static_ptr instanceof Deno.UnsafePointer, +); +const view = new Deno.UnsafePointerView(dylib.symbols.static_ptr); +console.log("Static ptr value:", view.getUint32()); + function cleanup() { dylib.close(); -- cgit v1.2.3