diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index b83309bc9d..fb5ed461cf 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -142,7 +142,7 @@ declare namespace Deno { * Opens a dynamic library and registers symbols */ export function dlopen>( - filename: string, + filename: string | URL, symbols: S, ): DynamicLibrary; diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index 3c4112a473..553ea1dd36 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.js @@ -3,6 +3,7 @@ ((window) => { const core = window.Deno.core; + const __bootstrap = window.__bootstrap; class DynamicLibrary { #rid; @@ -23,7 +24,9 @@ } function dlopen(path, symbols) { - return new DynamicLibrary(path, symbols); + // URL support is progressively enhanced by util in `runtime/js`. + const pathFromURL = __bootstrap.util.pathFromURL ?? ((p) => p); + return new DynamicLibrary(pathFromURL(path), symbols); } window.__bootstrap.ffi = { dlopen };