diff options
author | Havoc Pennington <hp@redhat.com> | 2003-06-23 02:12:19 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-06-23 02:12:19 +0000 |
commit | cef11442f69e9a649731f3b2a12b655996da265b (patch) | |
tree | 63968e3cc34dc13820515bd415adb58ebe14d221 /mono/DBus.cs | |
parent | 1cc184b4a849619b56bed2be0e752fbc0fb75a29 (diff) |
2003-06-22 Havoc Pennington <hp@pobox.com>
* mono/Connection.cs: add more bindings
* dbus/dbus-threads.c (dbus_threads_init): allow calling this
more than once.
Diffstat (limited to 'mono/DBus.cs')
-rw-r--r-- | mono/DBus.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/mono/DBus.cs b/mono/DBus.cs index 1032792a..e2751841 100644 --- a/mono/DBus.cs +++ b/mono/DBus.cs @@ -1,13 +1,33 @@ namespace DBus { using System; + using System.Runtime.InteropServices; public class Exception : ApplicationException { internal Exception (ref Error error) : base (Runtime.InteropServices.Marshal.PtrToStringAnsi (error.message)) { } } - public class Internals { - public const string Libname = "libdbus-1.so.0"; + internal class Internals { + internal const string DBusLibname = "libdbus-1.so.0"; + internal const string DBusGLibname = "libdbus-glib-1.so.0"; + internal const string GLibname = "libglib-2.0.so.0"; + internal const string GThreadname = "libgthread-2.0.so.0"; + + internal static void Init () { + if (!initialized) { + initialized = true; + g_thread_init ((IntPtr) 0); + dbus_gthread_init (); + } + } + + private static bool initialized = false; + + [DllImport (DBus.Internals.DBusGLibname, EntryPoint="dbus_gthread_init")] + private extern static void dbus_gthread_init (); + + [DllImport (DBus.Internals.GThreadname, EntryPoint="g_thread_init")] + private extern static void g_thread_init (IntPtr vtable); } } |