зеркало из https://github.com/mono/mail-archives.git
126 строки
5.0 KiB
HTML
126 строки
5.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Mono-osx] [ANN] objc3-sharp
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20%5BANN%5D%20objc3-sharp&In-Reply-To=591EE054-A39B-462D-AEF3-8919DC71AF39%40mac.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
|
|
<LINK REL="Previous" HREF="001432.html">
|
|
<LINK REL="Next" HREF="001434.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Mono-osx] [ANN] objc3-sharp</H1>
|
|
<B>Jesse Jones</B>
|
|
<A HREF="mailto:mono-osx%40lists.ximian.com?Subject=%5BMono-osx%5D%20%5BANN%5D%20objc3-sharp&In-Reply-To=591EE054-A39B-462D-AEF3-8919DC71AF39%40mac.com"
|
|
TITLE="[Mono-osx] [ANN] objc3-sharp">jesjones at mindspring.com
|
|
</A><BR>
|
|
<I>Mon Jun 9 05:43:06 EDT 2008</I>
|
|
<P><UL>
|
|
<LI>Previous message: <A HREF="001432.html">[Mono-osx] [ANN] objc3-sharp
|
|
</A></li>
|
|
<LI>Next message: <A HREF="001434.html">[Mono-osx] [ANN] objc3-sharp
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#1433">[ date ]</a>
|
|
<a href="thread.html#1433">[ thread ]</a>
|
|
<a href="subject.html#1433">[ subject ]</a>
|
|
<a href="author.html#1433">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>
|
|
On Jun 8, 2008, at 11:24 PM, Jérôme Gagnon-Voyer wrote:
|
|
|
|
><i> When you say it's similar to Mono objc-sharp library, do you talk
|
|
</I>><i> about monobjc? <A HREF="http://www.monobjc.net/">http://www.monobjc.net/</A>
|
|
</I>
|
|
No, I was talking about objc-sharp.
|
|
><i>
|
|
</I>><i>
|
|
</I>><i> Can you describe how is it faster and easier?
|
|
</I>><i>
|
|
</I>I confess this is the first time I've seen monobjc. It certainly looks
|
|
better than objc-sharp, but I'm not sure its design is better than
|
|
objc3-sharp (although it does look considerably more mature). Here are
|
|
some points of comparison (which are based on a few minutes of
|
|
inspection of the monobjc source, so take them with a grain of salt):
|
|
|
|
1) In monobjc methods are called like this:
|
|
|
|
Class cls1 = Class.GetClassFromName("TestClass04");
|
|
int result = ObjectiveCRuntime.SendMessage<int>(cls1, "TestWithA:b:",
|
|
789, 345);
|
|
|
|
With objc3-sharp you would instead write this as:
|
|
|
|
Class cls1 = new Class("TestClass04");
|
|
int result = (int) cls1.Call("TestWithA:b:", 789, 345);
|
|
|
|
or even nicer:
|
|
|
|
int result = (int) Native.Call("[TestClass04 TestWithA:{0} b:{1}]",
|
|
789, 345);
|
|
|
|
objc3-sharp will also let you chain calls (i.e.
|
|
foo.Call(...).Call(...) which I don't think monobjc supports.
|
|
|
|
2) objc3-sharp calls are very efficient. Basically all that they do is
|
|
marshal arguments into buffers and call into a small native library
|
|
where libffi takes care of the platform calling conventions. monobjc
|
|
is much much more complex. So complex, that I can't even figure out
|
|
what it's doing when it makes a native call.
|
|
|
|
3) objc3-sharp handles exceptions well no matter where they are
|
|
raised. If you call a native method and it raises NSException a
|
|
CocoaException will be thrown when the native call returns. The
|
|
CocoaException has a property which allows you to get the original
|
|
NSException. If you call a native method which winds up calling a
|
|
managed method and that throws, then the managed exception is
|
|
serialized into an NSException which is then raised in the native glue
|
|
library. If that exception makes it back to managed code a
|
|
TargetInvocationException is thrown where the inner exception is the
|
|
original exception.
|
|
|
|
As far as I can tell monobjc doesn't bridge exceptions at all.
|
|
|
|
4) monobjc doesn't seem to do anything to simplify reference counting.
|
|
objc3-sharp relies on the GC to know when to release objects which
|
|
dramatically simplifies reference count management.
|
|
|
|
5) objc3-sharp is way way simpler than monobjc. This seems to be
|
|
because objc3-sharp only supports 10.5, libffi plus a small native
|
|
glue library makes marshaling easy, and objc3-sharp has a narrower
|
|
focus: it's designed just to enable interop with Cocoa, not wrap the
|
|
entire Cocoa framework.
|
|
|
|
<<A HREF="http://code.google.com/p/objc3-sharp/wiki/Usage">http://code.google.com/p/objc3-sharp/wiki/Usage</A>> has some additional
|
|
code snippets if you're curious.
|
|
|
|
-- Jesse
|
|
</PRE>
|
|
|
|
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI>Previous message: <A HREF="001432.html">[Mono-osx] [ANN] objc3-sharp
|
|
</A></li>
|
|
<LI>Next message: <A HREF="001434.html">[Mono-osx] [ANN] objc3-sharp
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#1433">[ date ]</a>
|
|
<a href="thread.html#1433">[ thread ]</a>
|
|
<a href="subject.html#1433">[ subject ]</a>
|
|
<a href="author.html#1433">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
|
|
<hr>
|
|
<a href="http://lists.ximian.com/mailman/listinfo/mono-osx">More information about the Mono-osx
|
|
mailing list</a><br>
|
|
</body></html>
|