Skip to content

Deno.dlopen cannot open static asset #27068

Open
@vseplet

Description

Version: Deno 2.1.1

I tried to bundle my native library and script into a single executable file. Of course, I used the --include flag during compilation. After running the executable, I found that Deno.readFile successfully reads the static asset, but Deno.dlopen is unable to open it. Below is an example of the code:

const data = Deno.readFileSync(
  import.meta.dirname + "/static/libexample.dylib",
);

console.log(data.buffer.byteLength); // return correct size 1955522

const lib = Deno.dlopen(
  import.meta.dirname + "/static/libexample.dylib",
  {
    openWebView: {
      parameters: [],
      result: "void",
      nonblocking: false,
    },
  },
); // but Error: Could not open library: Could not open library

Metadata

Assignees

No one assigned

    Labels

    compilerelated to the `deno compile` featurefeatnew feature (which has been agreed to/accepted)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions