[Gtk-sharp-list] Gtk# 64-bit on Windows

Eric.Zurcher at csiro.au Eric.Zurcher at csiro.au
Sun Feb 25 23:44:16 UTC 2018


David,

Building Gtk# for 64-bit Windows wasn't all that difficult to do, but first I should clarify that I did my build for Gtk# 2.12, not for Gtk# 3.x.  Similar procedures can probably be used for either, but I've only dealt with the former. Also, I did not include glade in my builds.

A lot of the binaries you need for 64-bit Gtk# on Windows already exists. Native 64-bit Gtk+-2 binaries can be downloaded from https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer, and possibly other locations. Similarly, the existing .Net assemblies (like gtk-sharp.dll) are built to run on "Any CPU". The bit that's missing are the "glue" DLLs that connect these layers.

To generate the "glue" source, I obtained the gtk-sharp source by cloning the repository at https://github.com/mono/gtk-sharp.git, pulling the gtk-sharp-2-12-branch branch. I also started with the native 64-bit Gtk+ 2 binaries for version 2.24.31 from the source given above, and obtained the source for the corresponding version of atk, Cairo, gdk-pixbuf, glib, gtk+, and pango from http://ftp.acc.umu.se/pub/gnome/sources. I grabbed the source tree from http://files.xamarin.com/~duncan/gtk+-bundle-2-12-25.zip, but only used the gdkconfig.h and cairo-features.h files from there.

I then used Cygwin to configure and make gtk-sharp, specifying a build target of x86_64-w64-winnt. This built everything but left a few Cygwin dependencies in the resulting DLLs. As I had a few reasons for wanting to use Visual Studio in my builds, I created new project files for the atk, gdk, glib, gtk and pango "sharpglue-2" DLLs. This involved generating suitable import libraries for a few of the Gtk+ 2 DLLs, and creating new .def files to export all the entry points. To simplify the latter task, I extracted the list of the exports from the existing 32-bit versions; otherwise I would have somehow had to extract the names of over 700 functions from the source code. 

That's not as simple as one might like, but it's not really all that difficult, either. The results seem to work correctly, and our project is now shipping 64-bit releases for Windows. (We needed that because of a few users running into memory limitations when running the 32-bit versions.)

Eric Zurcher
Software developer | GrazPlan Project
CSIRO Agriculture and Food
 


More information about the Gtk-sharp-list mailing list