[Mono-osx] Dumbarton and Arrays
Allan Hsu
allan at counterpop.net
Thu Sep 28 15:56:15 EDT 2006
On Sep 27, 2006, at 7:23 AM, Eoin Norris wrote:
> Two questions.
>
> 1) I have only the intel version running. Is there a universal
> framework for mono and Dumbarton?
There are no official universal packages for Mono, but it is possible
to build Mono and its dependencies as a universal binary. I
occasionally make universal builds from Mono SVN and post them here:
http://strangecargo.org/~allan/mono/
Installation instructions can be found in the archives:
http://lists.ximian.com/pipermail/mono-osx/2006-September/000601.html
It should be noted that these builds are built for imeem, so I often
leave out things like libgdiplus and xsp from my builds, because we
don't actually require those in imeem.
Dumbarton from Mono SVN will compile as a universal binary if you
compile in the "Release" configuration, but this requires that you
have a universal Mono installed to link against.
> 2) I am passing values between the layers using a serialised string,
> as I could not get arrays to work. There were two problems here.
> 2.1) ( Which may be unsolvable) I had an array of dictionarys which
> means different types within the dictionary. Cant see how mono could
> know about an NSDateTime object
Can you be more explicit about what you're trying to do?
Particularly, which direction is this data going? Objective C to Mono?
There are ways to convert between some Cocoa types and C# types
through Objective C categories. In the case of DateTime objects and
NSDate objects, -[NSDate monoDateTime] will give you a C#
System.DateTime object from an NSDate. If you have a System.DateTime
object and need an NSDate, +[NSDate dateWithMonoDateTime:] or -
[NSDate initWithMonoDateTime:] will do what you want.
> 2.2) Even when trying to get an array of string objects some things
> were unclear
> The initializer in the sample code uses this
>
> - (id)initWithMonoObject:(MonoObject *)monoObject
> withRepresentationClass:(Class)representationClass;
>
> but it initializes the DBIList from an MonoArray which so happened to
This is wrong. MonoArray is the mono type for array objects. DBIList
and DBArrayList are for System.Collections objects. The sample code
creates a DBArrayList from a MonoObject of type
System.Collections.ArrayList.
> be returned from the mono layer. I presume you could initialise this
> list with any object and then add more objects to the list. In any
> case this problem was moot for when I tried to rename the method I
> was calling into to foo(ArrayList object) and called
If what you're trying to do is create an empty ArrayList or create an
ArrayList from an NSArray, there currently isn't functionality in
Dumbarton for this, though it wouldn't be hard to implement. If you
need this, I can hurry up and write it:). Functionality in Dumbarton
only gets written when somebody needs it.
> [self invokeMethod:"foo(ArrayList)" withNumArgs:1,monoArray];
> but that failed with the exception "method not found". Any ideas on
> this?
I think you may need to specify the full namespace for the argument
to your method. Try:
[self invokeMethod:"foo(System.Collections.ArrayList)" withNumArgs:
1, monoArray];
and see what happens.
-Allan
More information about the Mono-osx
mailing list