[Mono-list] passing MonoArray from c#
robertj at gmx.net
Fri May 1 21:00:50 EDT 2009
> hi all..
> I have a bag of floats/ints/strings that i would like to pass back from a c#
> method in response to a call from unmanaged c++. If tried returning an array
> of custom structs, but had an exception at runtime. Another exception occurs
> if i try to use an out parameter. Is there a Good way to do this?
There are no known issues returning arrays from managed to unmanged
while embedding mono. Arrays are returned like MonoObjects and
their elements can be accessed with the usual mono_array_* accessors.
Structs are always returned as a boxed reference by mono_runtime_invoke,
so you must unbox them. Casting the result to a struct type is not
Please post a sample or file a bug if you think you've found an issue.
More information about the Mono-list