gtksharpglue-2 not found when running Gtk# program on .NET

0

This is on a different machine than the one that my other recent Gtk# question applies to.

I am trying to run a Gtk# program on a Windows 7 x64 computer with all .NETs 1.0 to 4.0 installed. (I have been using Gtk# on this computer in the past, but more than a year ago for the last time.)

  • I have downloaded and installed Gtk# 2.12.26 by using the installer package from the Mono website.
  • I have verified that the bin directory of that Gtk# installation is on my search path.1
  • Using SharpDevelop, I have created a .NET console project.
  • I have added references to atk-sharp, gdk-sharp, glib-sharp, gtk-sharp, and Mono.Cairo.
  • I have added some minimal code (Application.Init();, creation and display of a new window).
  • When I run the application, the following exception is thrown:

    System.TypeInitializationException: Der Typeninitialisierer für "Gtk.Container" hat eine Ausnahme verursacht. ---> System.DllNotFoundException: Die DLL "gtksharpglue-2": Die angegebene Prozedur wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007F) kann nicht geladen werden.
       bei Gtk.Container.gtksharp_gtk_container_get_focus_child_offset()
       bei Gtk.Container..cctor()
       --- End of inner exception stack trace ---
       bei Gtk.Container..ctor(IntPtr raw)
       bei Gtk.Bin..ctor(IntPtr raw)
       bei Gtk.Window..ctor(WindowType type)
       bei Gtk.Window..ctor(String title)
       bei GtkSharpTest.Program.Main(String[] args) in ...\GtkSharpTest\Program.cs:Zeile 21.
    

The crucial bit of information seems to be:

System.DllNotFoundException: Die DLL "gtksharpglue-2": Die angegebene Prozedur wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007F) kann nicht geladen werden.

meaning

System.DllNotFoundException: Unable to load DLL "gtksharpglue-2": The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)

A file named gtksharpglue-2.dll is located in the Gtk# bin directory that is on the system search path. Notably, my local Mono installation has an older version of that file, but even if I replace the file in the Mono installation with the newer version, the message remains. None of Mono's installation directories is on my search path, anyway.

How can I fix this, and how can I make sure non-tech-savvy users of my Gtk# program will not run into the same issue?

1: Remarkably, the bin directory was not automatically added to the search path by the installer package (either that, or the search path had become too long once again and thus didn't work as desired, not sure any more); I had to manually edit the search path. In any case, before I had done so, libglib-2.0-0.dll was the file reported to be missing. After I had edited the search path, that file apparently could be loaded, just gtksharpglue-2.dll cannot.

.net
gtk#
asked on Stack Overflow Aug 17, 2015 by O. R. Mapper • edited May 23, 2017 by Community

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0