On 06/01/2017 12:28 AM, Dennis wrote:

On Wed, 31 May 2017 22:22:15 +0200, Mike Wey wrote:

It looks like you are using the 64bit version of the Gtk Runtime, did
you compile gtkD and the executable as 64bit?

I made an error in copying the error text. The DLL is not in:
C:\Program Files\Gtk-Runtime\bin\libfontcongif-1.dll
But in:
C:\Program Files (x86)\Gtk-Runtime\bin\libfontcongif-1.dll

Both of those directories exist though, I installed both the 32-bit version and the 64-bit version of the runtime. I also tried to compile both the 32-bit and 64-bit version, I don't know which version dub uses.

I think dub defaults to 32bit on Windows.

Trying manual again

I uninstalled the 64-bit runtime, cloned the repo and built without the -m64 flag. The build was successful this time, but I'm not sure about this step:

4. Copy GtkDExtractionDir\src to dmddir\src\gtkd

Sorry, that is some outdated info. You should move generated\gtkd.

I copied the src folder from C:\D\GtkD\src\, but it says:

dmd hello.d -Lgtkd.lib
hello.d(1): Error: module MainWindow is in file 'gtk\MainWindow.d' which cannot be read
import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos
import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import
import path[2] = C:\D\dmd2\windows\bin\..\..\src\gtkd

MainWindow.d is in C:\D\GtkD\generated\gtkd\gtk which I didn't copy, so I copied \generated\gtkd\ as well. I replaced the files that were in conflict with the already existing files. Running dmd hello.d -Lgtkd.lib gives:

OPTLINK : Warning 9: Unknown Option : NOIGTKD.LIB
hello.obj(hello)
  Error 42: Symbol Undefined _D3gtk5Label5Label6__ctorMFAyabZC3gtk5Label5Label
hello.obj(hello)
  Error 42: Symbol Undefined _D3gtk10MainWindow10MainWindow7__ClassZ
hello.obj(hello)

The linkers used differ between the 32 and 64 bit versions of dmd. Which
unfortunately use different flags to link with a library.

It's -L+gtkd.lib when building a 32bit application and -Lgtkd.lib
for 64bit. (I've updated the wiki to hopefully make that clearer)

Demos

I tried dub run --build=plain on the demos in the repo:

DemoActions: The function you are calling is not pressent in your version of GTK+.
DemoCustomList: ..\..\..\generated\gtkd\gtkd\Implement.d(351,2): Warning: statement is not reachable
DemoMultiCellRenderer: works
DemoMultithread: works
TestWindow: works, but outputs errors:

failed (libatk-1.0-0.dll) atk_document_get_current_page_number
failed (libatk-1.0-0.dll) atk_object_get_object_locale
(...) ~1700 lines
failed (libpango-1.0-0.dll) pango_renderer_get_alpha
failed (libpango-1.0-0.dll) pango_renderer_set_alpha

(TestWindow.exe:6516): Gtk-CRITICAL **: gtk_menu_attach: assertion 'left_attach < right_attach' failed

(...) more such errors after interacting with widgets

While the TestWindow demo will always print a list of functions that
couldn't be loaded as it does this explicitly. Mostly linux only functions.

Most of these errors would indicate you are using an old version of Gtk+
or at least GtkD finds some old version that is still installed someware.

The gtk_menu_attach: assertion 'left_attach < right_attach' failed for
example was fixed in Gtk+ 3.18, while the latest installer on gtkd.org
is for Gtk+ 3.22.