[Mono-osx] [ANN] mcocoa 0.4 and mobjc 0.5

Jesse Jones jesjones at mindspring.com
Wed Jan 21 03:35:29 EST 2009


mcocoa provides C# wrappers around nearly all of Apple's Foundation  
and AppKit frameworks. mobc is a bridge between Mono and Objective-C.  
Together these libraries allow you to write Cocoa applications using  
Mono. Unlike most other libraries mobjc properly handles exceptions  
arising in both managed and native code.

The libraries can be found at <http://code.google.com/p/mcocoa/> and <http://code.google.com/p/mobjc/ 
 >.

Changes to mcocoa include:
* Methods with native NSError ** arguments are now generated using out  
NSError instead of IntPtr. Ditto for NSRange ** and NSStringEncoding **.
* Generated code uses NSString instead of System.String.
* Generated method names use underscores instead of case changes (e.g.  
initWithDomain_code_userInfo instead of initWithDomainCodeUserInfo).
* Generated classes now define Retain instead of retain so that  
exported classes can define their own Retain methods (to support  
covaraint returns) without causing the Registrar to think that those  
types are overriding retain.
* Generated classes now have Alloc instead of alloc methods (so the  
API is more consistent).
* Added an overload of NSApplication::Create to make it easier for  
clients to extend the Debug menu.
* Added some Create overloads to make mcocoa easier to use with apps  
which have custom NSApplication subclasses.
* Added a custom NSWindowController to make custom window controllers  
easier to create.
* Added alert and path functions.
* Added a bunch more Enums and Externs.
* Fixed some leaks where HGlobals were not being freed.
* Added usage notes to the README.

Changes to mobjc include:
* Methods that start with a lower case letter are now automagically  
registered with Cocoa.
* Cache the buffers used by libffi. This aproximately doubles the  
speed of the slow path.
* The ivar setter now releases the old value and retains the new value.
* Renamed NSObject::CreateNative AllocNative because the caller  
assumes ownership of the result.
* Removed NSObject::Create (there's no real point to this method  
because it just created an instance of the root NSObject).
* Added NSObject::Retain to allow clients to retain objects with  
covariant returns (mcocoa used to declare retain methods for this, but  
that caused problems with exported types because the Registrar thought  
the types were overriding retain).
* Added a static NSObject::Class property to return the root NSObject  
class (and to be consistent with the NSObject derived classes in  
mcocoa).
* Cleaned up pointer marshaling:
     - If the native type is a char* or a unichar* you now must pass  
in null or an IntPtr: System.String will no longer be auto-marshaled  
to or from const char buffers.
     - There is no longer a special case for float arrays: instead  
higher level code must pass in an IntPtr.
     - Marshaling of arbitrary arrays and of unions should work (as  
long as you pass in null or an IntPtr).
* Cleaned up struct marshaling:
     - There is now a better exception if null is passed in.
     - An exception is now thrown if the managed and native structs do  
not match.
* If an exception is thrown while trying to register an exported  
method Registrar will now include the class and method name in the  
exception message.
* Fixed the NSObject IntPtr conversion operator so that it works with  
null objects.
* Fixed the To method so it no longer sometimes throws a NRE and has a  
better exception message for one of the cases.

   -- Jesse





More information about the Mono-osx mailing list