Found the problem.
To solve it the Nim application needs to load it's shared libraries with 
dlopen(RTLD_GLOBAL).

Regards,
Matic
________________________________
From: gtk-app-devel-list <gtk-app-devel-list-boun...@gnome.org> on behalf of 
Matic Kukovec via gtk-app-devel-list <gtk-app-devel-list@gnome.org>
Sent: Thursday, June 28, 2018 8:34 PM
To: gtk-app-devel-list@gnome.org
Subject: Simple GTK3 application in Nim?

Hi guys,

I have a very simple application written in the Nim programming language, which 
transpiles to C and is then compiled with GCC on Linux.
The application is very simple and uses the IUP shared library which underneath 
uses GTK3. Here is the code, just for reference:
import os
import iup

iup.open(nil, nil)
var font_dialog = fontDlg()
font_dialog.popup(IUP_CURRENT, IUP_CURRENT)
font_dialog.destroy()
iup.close()

When running the application, this error is thrown:
$ ./test

(test:6635): Gtk-WARNING **: Unknown type PangoFontFamily specified in 
treemodel model

(test:6635): Gtk-WARNING **: Unknown type PangoFontFace specified in treemodel 
model

(test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516: 
Invalid type (null)

(test:6635): Gtk-WARNING **: /home/pi/gtk+3.0-3.22.11/./gtk/gtkliststore.c:516: 
Invalid type (null)

(test:6635): GLib-GObject-CRITICAL **: g_value_type_transformable: assertion 
'G_TYPE_IS_VALUE (src_type)' failed

(shutdown:6635): GLib-GObject-CRITICAL **: g_value_type_transformable: 
assertion 'G_TYPE_IS_VALUE (src_type)' failed

(test:6635): GLib-GObject-WARNING **: 
/build/glib2.0-F5w919/glib2.0-2.50.3/./gobject/gtype.c:4264: type id '0' is 
invalid

(test:6635): GLib-GObject-WARNING **: can't peek value table for type 
'<invalid>' which is not currently referenced
Traceback (most recent call last)
test.nim(7)         test
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Now the problem, as far as I can guess, is that Nim behind the scenes uses the 
dlopen function to link to the IUP shared library, which messes up something 
with GTK.
I may be completely wrong on this, I drew this conclusion from this wxWidgets 
issue: https://trac.wxwidgets.org/ticket/16820#no1

Can someone point me in a direction of how this can be fixed, because I do not 
have enough experience with this subject?

Thank you,
Matic
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to