Hello: I followed Alberto Zin's instructions for compiling pd externals using Mingw and they worked OK. But: I modified de hello.c code adding the opening and closing of a file. Of course, the <stdio.h> header file must be added to the code. Attached to this message is the modified "hello.c". The code compiles Ok, and I get the hello.o using the following command line:
C:\pd\isidro\hello>gcc -c hello.c -o hello.o
But when I try to link to get the Dll file, I get the following message:
C:\pd\isidro\hello>ld -export_dynamic -shared -o hello.dll hello.o c:/pd/bin/pd.dll
hello.o(.text+0x16):hello.c: undefined reference to
fopen' hello.o(.text+0x30):hello.c: undefined reference to
fclose'
The same I get if I use some Standard Library Function like <string.h> or other... Maybe I am doing something really stupid but if you know what's up it will save lots of time to me... Many thanks Isi
Get the free Yahoo! toolbar and rest assured with the added security of spyware protection. http://new.toolbar.yahoo.com/toolbar/features/norton/index.php
#include "m_pd.h" #include <stdio.h>
static t_class *hello_class;
typedef struct _hello{ t_object x_obj; } t_hello;
void hello_bang(t_hello *x) { FILE *fil;
fil=fopen("any","rb"); post("File any opened"); fclose(fil); }
void *hello_new(void) { t_hello *x = (t_hello *)pd_new(hello_class);
return (void *)x; }
void hello_setup(void) { hello_class = class_new(gensym("hello"), (t_newmethod)hello_new, 0, sizeof(t_hello), CLASS_DEFAULT, 0); class_addbang(hello_class, hello_bang); }