[Mono-list] Windows.Forms on OSX

Tom tom7ca@yahoo.com
Thu, 18 Apr 2002 18:18:30 -0700 (PDT)


There is a better way than going out and writing C wrappers 
for all the Cocoa stuff.

You can think of Objective-C as a much simpler and more powerful version
of COM/ActiveX with a dynamic invocation interface on every object and
the ability to add new methods to existing classes and instances.  (It's
a shame that Microsoft went off on the COM tangent, but I digress.)

You wouldn't provide access to COM/ActiveX by writing a wrapper for every
possible COM object in existence and compiling it.  Instead, you create
a general mechanisms that lets programmers access arbitrary COM/ActiveX
instances; that's kind of the whole point.  Well, talking to Objective-C
is no different.

Objective-C lets you instantiate objects, call methods, and access
instance variables completely at runtime.  Take a look at the Lua
bindings to see how this is done:

  http://www.dekorte.com/Software/Lua/LuaObjective-C/

Also, here is a program that explores Objective-C introspection:

  http://www.apple.com/downloads/macosx/development_tools/selfintrospector.html

Since you can generate CLR byte codes at runtime, you could, in fact,
arrange for accessing any Objective-C class from CLR through a simple
runtime call:

  SomeInterface instance = 
    ObjectiveC.InstantiateConformingTo("SomeObjectiveCClass",someInterface);

See below for more details on how to write this kind of code (that's
for Java, but C#/CLR is completely analogous):

  http://tmb.voxel.net/papers/published/2001-breuel-tools.pdf

Solving the problem once then lets people access any current and future
Objective-C class with a single function call and a C# definition
of their desired interface.

Tom

--- Miguel de Icaza <miguel@ximian.com> wrote:
> Hello Jonathan!
> 
>    You have confirmed some of my thinking.  Thanks for addressing the
> mailing list. 
> 
> > As far as the claim that Cocoa can only be accessed from Objective-C and
> > Java, that is at least partially true.  But remember that Objective-C is
> > simply a superset of ANSI C.  This means that you could easily write a
> > standard C program and compile it with an Objective-C compiler.  With this
> > in mind, I do not think that this would be too large of a barrier to the
> > Windows.Forms implementation.
> 
> Objective-C will not be a problem at all ;-)
> 
> Miguel.
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/