Hello everyone - I am writing an external in C that needs to output a list consisting of an integer, followed by a string (symbol). In PD, I plan to route this list based on the first element. I'm having trouble figuring out the correct way to do this though. Can someone tell me what I'm doing wrong in the following code?
A related question: If my end goal is to route by the int, and use the string separately, would I be better off using sprintf to pack the int and string into a single symbol for output? thanks very much, -David Merrill note: I have tried both outlet_list, and outlet_anything, and both cause the segfault.
static void output_inputpath(t_input_noticer *x, int idx, char *path) { t_atom t[2];
SETFLOAT(&(t[0]),idx); SETSYMBOL(&(t[1]),gensym(path));
// THE FOLLOWING LINE SEGFAULTS PD outlet_list(x->notify_out, &s_list, 2, t); }
On Sun, 23 Apr 2006, David Merrill wrote:
static void output_inputpath(t_input_noticer *x, int idx, char *path) { t_atom t[2]; SETFLOAT(&(t[0]),idx); SETSYMBOL(&(t[1]),gensym(path)); // THE FOLLOWING LINE SEGFAULTS PD outlet_list(x->notify_out, &s_list, 2, t); }
check that x is valid, and that notify_out is properly initialized to a t_outlet.
You may want to use the Valgrind debugger which can tell you things about bad use of malloc() and free() and can also report uninitialized values.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada