yes, I remember the compilation fails on Visual Studio if your dll is loaded by an application so if Pd is running a patch with your external you can't compile before closing Pd.
You still don't use the realloc method properly. The method is for reallocation, so you should give it the pointer to the memory you want to resize.
Something like
temp_vector = realloc(x->vector, len_avg_new * x->block_size * sizeof(t_sample*));
if (temp_vector) {
// allocation succeed
x->vector = temp_vector;
}
else
{
// allocation failed but x->vector isn't freed so you have the choice,
// you can free it or continue to use the memory allocated.
free(x->vector);
x->vector = NULL;
}
With the first, x->vector
should be set to NULL
, this way the method will acts like malloc. In your code, you allocate new memory each time you resize the arrays without releasing them thus you have a lot of memory leaks.
Small esthetic remark: you can remove x_in and x_out in your object's structure, you never use it (and use directly outlet_new(&x->x_obj, &s_signal);
without x->x_out =
before).