Hey there,
I'm trying to write a simple external on my way for learning how to write them, i've followed the "HOW-TO"tutorial building succesfully the examples in there.
The extern I'm trying to build it's suposed to solve the pitagoras triangle, but well the math operation here it's not important here, but the management of the inlets and outlets is, also writting the propper code for making the class. The thing is that it does compile in XCode but when I try calling it in PD it just doesn't work and i get a post like this :
"/Applications/Pd-extended.app/Contents/Resources/extra/pitagorin/pitagorin.pd_darwin: dlopen(/Applications/Pd-extended.app/Contents/Resources/extra/pitagorin/pitagorin.pd_darwin, 10): Symbol not found: _class_addsolve
Referenced from: /Applications/Pd-extended.app/Contents/Resources/extra/pitagorin/pitagorin.pd_darwin
Expected in: dynamic lookup
pitagorin
... couldn't create"
I'm sure that something is wrong with my code, but still dunno what&where!
Here it is:
#include "m_pd.h"
static t_class *pitagorin_class;
typedef struct _pitagorin{
t_object x_obj;
t_float A,B;
t_outlet *result_out;
}t_pitagorin;
void pitagorin_solve(t_pitagorin *x){
t_float result;
result= ( sqrt( x->A*x->A + x->B*x->B) );
outlet_float(x->x_obj.ob_outlet,result);
}
void *pitagorin_new(t_symbol *s,int argc, t_atom *argv){
t_pitagorin *x=(t_pitagorin *)pd_new(pitagorin_class);
floatinlet_new(&x->x_obj,&x->A);
floatinlet_new(&x->x_obj,&x->B);
x->result_out=outlet_new(&x->x_obj, &s_float);
return (void*)x;
}
void pitagorin_setup(void){
pitagorin_class = class_new(gensym("pitagorin"),
(t_newmethod)pitagorin_new,
0, sizeof(t_pitagorin),
CLASS_DEFAULT,
A_DEFFLOAT, 0);
class_addsolve(pitagorin_class, pitagorin_solve);
}
Thanx so much!