diff options
author | Havoc Pennington <hp@redhat.com> | 2003-06-22 05:53:06 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-06-22 05:53:06 +0000 |
commit | 93b5a19c9f0979b5f227760af2ce5a0d076521f9 (patch) | |
tree | 1704ae1cbebdfacc0ca5d7c98e9c90bf55b27fd3 /mono | |
parent | 8e99e853a7abbb5344240c35b66853eeaedca48e (diff) | |
download | dbus-93b5a19c9f0979b5f227760af2ce5a0d076521f9.tar.gz |
2003-06-22 Havoc Pennington <hp@pobox.com>
* 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.
Diffstat (limited to 'mono')
-rw-r--r-- | mono/.cvsignore | 14 | ||||
-rw-r--r-- | mono/Makefile.am | 25 | ||||
-rw-r--r-- | mono/Message.cs | 50 | ||||
-rw-r--r-- | mono/Test.cs | 12 |
4 files changed, 101 insertions, 0 deletions
diff --git a/mono/.cvsignore b/mono/.cvsignore new file mode 100644 index 00000000..7657837d --- /dev/null +++ b/mono/.cvsignore @@ -0,0 +1,14 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.la +*.bb +*.bbg +*.gcov +*.da +.dbus-keyrings +*.dll +*.exe +test-dbus-sharp diff --git a/mono/Makefile.am b/mono/Makefile.am new file mode 100644 index 00000000..d81bcc28 --- /dev/null +++ b/mono/Makefile.am @@ -0,0 +1,25 @@ +DESTDIR= + +DLLS=dbus-sharp.dll +NOINST_EXES=test-dbus-sharp + +DBUS_SHARP_FILES=Message.cs +TEST_DBUS_SHARP_FILES=Test.cs + +all: $(DLLS) $(NOINST_EXES) + +dbus-sharp.dll: $(DBUS_SHARP_FILES) + $(MCS) $(MCSFLAGS) --unsafe --target library -o dbus-sharp.dll --recurse '$(DBUS_SHARP_FILES)' + +test-dbus-sharp: $(TEST_DBUS_SHARP_FILES) + $(MCS) $(MCSFLAGS) --unsafe --target exe -L . -r dbus-sharp.dll -o test-dbus-sharp --recurse '$(TEST_DBUS_SHARP_FILES)' + +clean: + rm -f $(DLLS) $(NOINST_EXES) + +install: all + ../mkinstalldirs $(DESTDIR)$(prefix)/lib && \ + cp $(DLLS) $(DESTDIR)$(prefix)/lib || exit 1 + +EXTRA_DIST=$(DBUS_SHARP_FILES) + 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); + } +} diff --git a/mono/Test.cs b/mono/Test.cs new file mode 100644 index 00000000..ffe7d0a6 --- /dev/null +++ b/mono/Test.cs @@ -0,0 +1,12 @@ + +using System; + +class Test { + static void Main() { + DBus.Message m; + + m = new DBus.Message ("org.freedesktop.Foo", null); + + Console.WriteLine ("Message name is {0}\n", m.Name); + } +} |