From 93b5a19c9f0979b5f227760af2ce5a0d076521f9 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 22 Jun 2003 05:53:06 +0000 Subject: 2003-06-22 Havoc Pennington * mono/*, gcj/*, configure.in, Makefile.am: Check in makefiles and subdirs for mono and gcj bindings. Neither binding actually exists, just trying to get through all the build and other boring bits. --- mono/Message.cs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 mono/Message.cs (limited to 'mono/Message.cs') diff --git a/mono/Message.cs b/mono/Message.cs new file mode 100644 index 00000000..84bd12ec --- /dev/null +++ b/mono/Message.cs @@ -0,0 +1,50 @@ +namespace DBus { + + using System; + using System.Runtime.InteropServices; + + public class Message { + + public Message (string name, + string dest_service) { + raw = dbus_message_new (name, dest_service); + } + + public string Name { + get { + return dbus_message_get_name (raw); + } + } + + IntPtr raw; + + ~Message () { + dbus_message_unref (raw); + } + + Message (IntPtr r) { + raw = r; + dbus_message_ref (r); + } + + // static constructor runs before any methods + static Message () { + + } + + const string libname = "libdbus-1.so.0"; + + [DllImport (libname, EntryPoint="dbus_message_new")] + private extern static IntPtr dbus_message_new (string name, + string dest_service); + + [DllImport (libname, EntryPoint="dbus_message_unref")] + private extern static void dbus_message_unref (IntPtr ptr); + + [DllImport (libname, EntryPoint="dbus_message_ref")] + private extern static void dbus_message_ref (IntPtr ptr); + + [DllImport (libname, EntryPoint="dbus_message_get_name")] + private extern static string dbus_message_get_name (IntPtr ptr); + } +} -- cgit