Task: I need to write an external library in C. A list with the name of the array comes to the object's inlet. How to get a pointer to this array inside an external library in C language?
-
Externals in C: How to access the array
-
see d_array.c in the sources as an example: seems like the way to do this is use
pd_findbyclass(t_symbol, garray_class)
here's a section from tabread:if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) pd_error(x, "%s: no such array", x->x_arrayname->s_name); else if (!garray_getfloatwords(a, &npoints, &vec)) pd_error(x, "%s: bad template for tabread", x->x_arrayname->s_name); else { int n = f; if (n < 0) n = 0; else if (n >= npoints) n = npoints - 1; outlet_float(x->x_obj.ob_outlet, (npoints ? vec[n].w_float : 0)); }