Commit 2346faac9500524ecd2d98fedcfe4ad61a32d3c7

Thomas de Grivel 2024-12-17T12:22:40

dlopen

diff --git a/gtk4/object.c b/gtk4/object.c
new file mode 100644
index 0000000..810d666
--- /dev/null
+++ b/gtk4/object.c
@@ -0,0 +1,18 @@
+/* kc3
+ * Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include "object.h"
+
+void kc3_gtk4_object_unref (GObject **object)
+{
+  g_object_unref(G_OBJECT(*object));
+}
diff --git a/gtk4/object.h b/gtk4/object.h
new file mode 100644
index 0000000..beb57cf
--- /dev/null
+++ b/gtk4/object.h
@@ -0,0 +1,20 @@
+/* kc3
+ * Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef KC3_GTK4_OBJECT_H
+#define KC3_GTK4_OBJECT_H
+
+#include "types.h"
+
+void kc3_gtk4_object_unref (GObject **object);
+
+#endif /* KC3_GTK4_OBJECT_H */
diff --git a/lib/kc3/0.1/gtk4/file.kc3 b/lib/kc3/0.1/gtk4/file.kc3
index 022e486..9740468 100644
--- a/lib/kc3/0.1/gtk4/file.kc3
+++ b/lib/kc3/0.1/gtk4/file.kc3
@@ -1,5 +1,7 @@
 defmodule Gtk4.File do
 
+  dlopen(__DIR__ + "../gtk4.so")
+
   def new_for_uri = cfn Ptr "kc3_gtk4_file_new_for_uri" (Result, Str)
 
 end
diff --git a/lib/kc3/0.1/gtk4/menu.kc3 b/lib/kc3/0.1/gtk4/menu.kc3
index 9da6b5e..b9c7d42 100644
--- a/lib/kc3/0.1/gtk4/menu.kc3
+++ b/lib/kc3/0.1/gtk4/menu.kc3
@@ -1,5 +1,7 @@
 defmodule Gtk4.Menu do
 
+  dlopen(__DIR__ + "../gtk4.so")
+
   def new = cfn Ptr "kc3_gtk4_menu_new" (Result)
 
   def append_item = cfn Void "kc3_gtk4_menu_append_item" (Ptr, Ptr)
diff --git a/lib/kc3/0.1/gtk4/object.kc3 b/lib/kc3/0.1/gtk4/object.kc3
new file mode 100644
index 0000000..57e4a17
--- /dev/null
+++ b/lib/kc3/0.1/gtk4/object.kc3
@@ -0,0 +1,5 @@
+defmodule Gtk4.Object do
+
+  def unref = cfn Void "kc3_gtk4_object_unref" (Ptr)
+
+end