summaryrefslogtreecommitdiff
path: root/ext/ffi/00_ffi.js
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2021-08-24 14:09:00 +0100
committerGitHub <noreply@github.com>2021-08-24 15:09:00 +0200
commit1b7848c4a9f6ba848452c9b3a9e88e95c17ab295 (patch)
treea33800c5cf9e0ce879cc958eee64d0b3623d769d /ext/ffi/00_ffi.js
parent8c57a6b7e3e53506c6b62f76cdb51745ff6d4036 (diff)
feat(unstable): Support file URLs in Deno.dlopen() (#11658)
Diffstat (limited to 'ext/ffi/00_ffi.js')
-rw-r--r--ext/ffi/00_ffi.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js
index 3c4112a47..553ea1dd3 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 };