[Gtk-sharp-list] Male Gtk# come with program

Thomas Pryds Lauritsen pryds at duckburg.dk
Sun Feb 12 13:42:22 EST 2006


I have made a small GUI program in C# / Gtk# that runs fine on my Ubuntu
installation. I'd like the program to also run on other distributions,
and even Windows (using either mono or MS .NET), if possible without
forcing the user to install Gtk# first. Can this be done? Someone told
me that I can just copy the appropriate dlls to the same dir as the .exe
file but that doesn't seem to work properly when I test it on a Fedora
Core 3 installation with mono.

I use the following in my program:

using System;
using System.Collections;
using System.IO;
using Gtk;
using Gnome;
using GLib;

I have the copied all the dlls from /usr/lib/mono/gtk-sharp-2.0/ to the
same dir as the .exe file. These are:
art-sharp.dll atk-sharp.dll gconf-sharp.dll gconf-sharp.dll
gconf-sharp-peditors.dll gdk-sharp.dll glade-sharp.dll glib-sharp.dll
gnome-sharp.dll gnome-vfs-sharp.dll gtk-dotnet.dll gtkhtml-sharp.dll
gtk-sharp.dll pango-sharp.dll rsvg-sharp.dll vte-sharp.dll (I know many
of the files are probably not needed, but I just copied them all to be sure)

When I try it on the Fedora system, I get the following:

[thomas at thorn DizniLogsTest]$ mono DizniLogs.exe

Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for GLib.GType --->
System.DllNotFoundException: libgobject-2.0-0.dll
in (wrapper managed-to-native) GLib.GType:g_type_init ()
in <0x001ee> GLib.GType:.cctor ()--- End of inner exception stack trace ---

in <0x00000> <unknown method>
in <0x000a7> Gtk.TreeStore:.ctor (System.Type[] types)
in <0x0009c> MyProgram:.ctor (System.String[] args)
in <0x00019> MainClass:Main (System.String[] args)

I can't seem to find the libgobject-2.0-0.dll file anywhere on the
Ubuntu system, though, but I did find a file called libgobject-2.0.so --
however the same error message appears even though this file is in the

So, my question is: Can this be done at all? If so, how? I know this is
not the usual way to do things on Linux, but for this specific program
it makes the most sense.

Oh, and someone suggested to me to enable static linking while compiling
so that the needed libraries are compiled into the .exe file. Can this
be done in this case, and if so: How do I do that from monodevelop?

Thanks in advance,

More information about the Gtk-sharp-list mailing list