[Mono-devel-list] Creating a string[] from C

James Lamanna jamesl at appliedminds.com
Thu Feb 5 12:53:20 EST 2004

I'm trying to embed the mono runtime and I'm writing a function that 
returns a string[] from C.
However I have had no luck so far:
My C# code will hang with the following:

string[] s_array = generateArrayFromC();

The C code that I'm using to generate the array looks something like this:
static MonoArray *generateArrayFromC()
     MonoString *test_string = mono_string_new(domain, "Test String");
     MonoArray *ip_array;
     int elem_size;

     ip_array = mono_array_new(domain, mono_defaults.string_class, 1);
     elem_size = mono_array_element_size(ip_array->obj.vtable->klass);
     memcpy(mono_array_addr_with_size(ip_array, elem_size, 0), test_string, 

     return ip_array;

Please CC me for I'm not subscribed.


James Lamanna
Applied Minds, Inc.
1209 Grand Central Ave.
Glendale, CA 91201
(818) 332-5214

More information about the Mono-devel-list mailing list