ahgilak / deno_gi

Deno port of Gnome libraries (such as Gtk).
https://deno.land/x/deno_gi
33 stars 2 forks source link

Error trying to execute the example code #2

Closed MrHoss closed 1 year ago

MrHoss commented 1 year ago

I got this error trying to use the example code 😭

Code:


import Gtk from "https://gir.deno.dev/Gtk-4.0";

const app = new Gtk.Application();

app.on("activate", () => {
  const win = new Gtk.ApplicationWindow({ application: app });
  const contentArea = new Gtk.Box();
  const label = new Gtk.Label({ label: "Hello World!" });

  contentArea.append(label);
  win.setChild(contentArea);
  win.show();
});

app.run([]);

Error:


$ deno run --unstable --allow-ffi main.ts 
error: Uncaught TypeError: Expected External at position 0
  return Deno.UnsafePointerView.getCString(pointer, offset);
                                ^
    at Function.getCString (ext:deno_ffi/00_ffi.js:162:16)
    at fromCString (https://deno.land/x/deno_gi@v0.5.0/src/utils/string.ts:11:33)
    at GIArgumentToJS (https://deno.land/x/deno_gi@v0.5.0/src/types/argument.ts:257:14)
    at createConstant (https://deno.land/x/deno_gi@v0.5.0/src/types/constant.ts:13:18)
    at handleInfo (https://deno.land/x/deno_gi@v0.5.0/src/handleInfo.ts:18:14)
    at defineInfo (https://deno.land/x/deno_gi@v0.5.0/src/gi.ts:31:16)
    at require (https://deno.land/x/deno_gi@v0.5.0/src/gi.ts:59:5)
    at https://gir.deno.dev/Gtk-4.0:3:20


ahgilak commented 1 year ago

There were some breaking changes in deno that has caused problems.

I'm planning on a rewrite of some parts that will hopefully fix it.

For now you can use deno version 1.30 or earlier.

Suyashtnt commented 1 year ago

There were some breaking changes in deno that has caused problems.

I'm planning on a rewrite of some parts that will hopefully fix it.

For now you can use deno version 1.30 or earlier.

How is the rewrite going? I'm attempting it myself and it's quite tedious

ahgilak commented 1 year ago

There's been some progress.

It would probably be ready for release in about two weeks.

MrHoss commented 1 year ago

Still working with Gnome 45? We have this new problema now, because have some breaking changes in the new Gnome 45...

ahgilak commented 1 year ago

Since libraries are resolved at runtime, updates to gnome or related libraries (other than glib its self) won't break the functionality. But there might be inconsistency with type definitions.