Hi Leo,
compilation of the external depends, first of all, on the operating system
you use to run PD. For example on Windows you have two ways:
Microsoft VIsual C++ (MSVC) (or Borland C++) offer integrated environments
for writing, compilation and debug;
Cygwin or MSYS on the other hand offer you all the tools you need
in a "unix" style like the compiler gcc, the make utility etc.. (I prefer the latter
solution, I'm old style .
On linux the "native" way is to use the shell and the gcc/makefile tools,
but also there you have integrated environments.
Don't know about Mac OSx.
To make it easy, suppose you have to compile the helloworld.c you find at
the end of the post from the command line (in linux):
First of all copy the file m_pd.h (you should have it somewhere in
your PD distribution) in the directory where you placed helloworld.c. Then
> gcc -c helloworld.c -o helloworld.o
> ld -export_dynamic -shared -o helloworld.pd_linux helloworld.o -lc -lm
congratulations, you've done it!
The first is the compilation step, the second is the link.
At this point copy the file helloworld.pd_linux in a directory that
PD can find (the /extra directory could be a good place). Start PD,
open new patch, create the object [helloworld] ad it should be ok!
(it should create without errors..)
good luck!
Alberto
--------------------------- helloworld.c -----------------------------------
#include "m_pd.h"
static t_class *helloworld_class;
typedef struct _helloworld {
t_object x_obj;
} t_helloworld;
void helloworld_bang(t_helloworld *x)
{
post("Hello world !!");
}
void *helloworld_new(void)
{
t_helloworld *x = (t_helloworld *)pd_new(helloworld_class);
return (void *)x;
}
void helloworld_setup(void) {
helloworld_class = class_new(gensym("helloworld"),
(t_newmethod)helloworld_new,
0, sizeof(t_helloworld),
CLASS_DEFAULT, 0);
class_addbang(helloworld_class, helloworld_bang);
}
-------------------end helloworld.c-------------------------