when the following is compiled via nim -r c
# Nim Compiler Version 0.17.0 (2017-05-17) [Linux: amd64]
import strutils, tables
import gtk2
import gdk2
import glib2
type
Foo = object
size:int
stuff:TableRef[string,string]
var zap:Foo
echo "nothing to do"
I get this error:
Error: cannot instantiate TableRef
got: (proc (drawable: PDrawable, font: PFont, gc: PGC, x: gint, y: gint, text: cstring, text_length: gint){.cdecl, gcsafe.} | string, proc (drawable: PDrawable, font: PFont, gc: PGC, x: gint, y: gint, text: cstring, text_length: gint){.cdecl, gcsafe.} | string)
but expected: (A, B)
but commenting out the import glib2 line produces a result that compiles and runs. I've tried different import orders but that seems not to be relevant. The gtk2 package was installed via nimble a few days ago (today=5-21-2017). A more complex version of this (on an older linux box) was working several months ago.
Is there a workaround?
That is an interesting bug. Currently I have no guess for the reason.
I just tried compile with GTK3 from
by modifying code to
import gtk3
import gdk3
import glib
Compiles and works fine.
Nim Compiler Version 0.17.0 (2017-05-19) [Linux: amd64]
Well, when you like old GTK2 still, you may like Nim v 0.16 or older too :-)
If not, maybe try deleting repeatly some code lines from glib until error vanish. And tell Araq or Dom the exact line number which causes the problem.
If you really like GTK, you may test a high level Nim GTK3 module soon.
Well, you blamed glib2 module.
But my guess would be gdk2 with
proc string*(drawable: PDrawable, font: PFont, gc: PGC, x: gint,
y: gint, text: cstring, text_length: gint){.cdecl, dynlib: lib,
importc: "gdk_draw_string".}
You may try
import gdk2 except string
or delete that entry from module gdk2.
To Stefan,
YES - you saved me!! - that did it - many thanks
I need a lightweight/cross platform/somewhat native/gui module that allows DOM <table> like layouts - which ruled out FLTK 1.x. Gtk is a heavy installation on non-nix platforms.
At the time I decided on the Linux version of my DIY module, gtk3 had some complaints, so I used gtk2. The MSW version goes directly to its API. I have no clue as how to do OS X.
Is gtk2 now deprecated or just unfavored?
Is gtk2 now deprecated or just unfavored?
Just unfavored, I would say.
Quite a concerning bug, was it reported on github?