[Mono-dev] Embedded API: mono_array_element_size issue

jonathan at mugginsoft.com jonathan at mugginsoft.com
Wed Oct 2 10:21:32 UTC 2013


The following raises so I presume that I have used it incorrectly:
   
    MonoClass *arrayClass = mono_get_byte_class();
    int32_t elementSize = mono_array_element_size(arrayClass);

* Assertion at class.c:8201, condition `ac->rank' not met

The entire method is:

- (MonoArray *)monoArray {
    
    // get mono array info
    MonoClass *arrayClass = mono_get_byte_class();
    int32_t elementSize = mono_array_element_size(arrayClass);
    //int32_t elementSize = sizeof(char);  // workaround
    
    // assign the mono array
    uintptr_t byteLength = [self length];
    MonoArray *monoArray = mono_array_new(mono_domain_get(), arrayClass, byteLength);

    // copy the NSData bytes  to the Mono array
    char *buffer = mono_array_addr_with_size(monoArray, elementSize, 0);
    [self getBytes:buffer length:[self length]];
	
	return(monoArray);
}

Jonathan












More information about the Mono-devel-list mailing list