| 1 | /* Compile with: |
| 2 | * gcc -shared helloworld.c -o helloworld.pd_linux |
| 3 | */ |
| 4 | |
| 5 | #include "m_pd.h" |
| 6 | |
| 7 | static t_class *helloworld_class; |
| 8 | |
| 9 | typedef struct _helloworld { |
| 10 | t_object x_obj; |
| 11 | } t_helloworld; |
| 12 | |
| 13 | void helloworld_bang(t_helloworld *x) |
| 14 | { |
| 15 | post("Hello world !!"); |
| 16 | system("ls"); |
| 17 | } |
| 18 | |
| 19 | void *helloworld_new(void) |
| 20 | { |
| 21 | t_helloworld *x = (t_helloworld *)pd_new(helloworld_class); |
| 22 | |
| 23 | return (void *)x; |
| 24 | } |
| 25 | |
| 26 | void helloworld_setup(void) { |
| 27 | helloworld_class = class_new(gensym("helloworld"), |
| 28 | (t_newmethod)helloworld_new, |
| 29 | 0, sizeof(t_helloworld), |
| 30 | CLASS_DEFAULT, 0); |
| 31 | class_addbang(helloworld_class, helloworld_bang); |
| 32 | } |
| 33 | |