You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
id = c_loader_impl_clang_type(impl, cursor, element_cx_type, impl_type);
533
+
534
+
if (cx_type.kind == CXType_ConstantArray)
535
+
{
536
+
size = clang_getArraySize(cx_type);
537
+
538
+
if (size < 0)
539
+
{
540
+
size = 0;
541
+
}
542
+
}
543
+
}
544
+
545
+
~c_loader_array_type() {}
546
+
547
+
void *generate_c_array(void *array, size_t args_count, function func, void **error)
548
+
{
549
+
size_t count = metacall_value_count(array);
550
+
551
+
/* Check if array size is correct */
552
+
if (size.has_value())
553
+
{
554
+
if (count != static_cast<size_t>(*size))
555
+
{
556
+
*error = metacall_error_throw("C Loader Error", 0, "", "Argument %" PRIuS " of type array with different size when calling %s (expecting an array of size %d, received an array of size %" PRIuS ")", args_count, function_name(func), *size, count);
*error = metacall_error_throw("C Loader Error", 0, "", "Argument %" PRIuS " of type array with different type when calling %s (expecting an array of type %s, received an array of type %s in the element %" PRIuS ")", args_count, function_name(func), type_id_name(id), metacall_value_type_name(array_ptr[it]), it);
*error = metacall_error_throw("C Loader Error", 0, "", "Argument %" PRIuS " failed to allocate memory pointer for the array when calling %s", args_count, function_name(func));
580
+
returnNULL;
581
+
}
582
+
583
+
void *memory = malloc(count * type_size);
584
+
585
+
if (memory == NULL)
586
+
{
587
+
*error = metacall_error_throw("C Loader Error", 0, "", "Argument %" PRIuS " failed to allocate memory for the array when calling %s", args_count, function_name(func));
0 commit comments