hi
i was asking about creating an external on windows few weeks ago, here i am again, now i have detailed info about the error the engineer from my uni is getting. He says he is using microsoft dev estydio 6.0 and pd.lib library to try to compile the "hello world" example. The source code is
#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,(t_atomtype)0); // He tenido que hacer este para que el compilador no me de error class_addbang(helloworld_class, helloworld_bang); }
he does not get error but some warnings when compiling:
compiling... hello.cpp C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(71) : warning C4091: 'extern ' : ignored on left of 'struct _array' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(141) : warning C4091: 'extern ' : ignored on left of 'struct _class' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(144) : warning C4091: 'extern ' : ignored on left of 'struct _outlet' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(147) : warning C4091: 'extern ' : ignored on left of 'struct _inlet' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(150) : warning C4091: 'extern ' : ignored on left of 'struct _binbuf' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(153) : warning C4091: 'extern ' : ignored on left of 'struct _clock' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(156) : warning C4091: 'extern ' : ignored on left of 'struct _outconnect' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(159) : warning C4091: 'extern ' : ignored on left of 'struct _glist' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(381) : warning C4091: 'extern ' : ignored on left of 'struct _widgetbehavior' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(384) : warning C4091: 'extern ' : ignored on left of 'struct _parentwidgetbehavior' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(571) : warning C4091: 'extern ' : ignored on left of 'struct _garray' when no variable is declared Linking... LINK : warning LNK4089: all references to "pd.dll" discarded by /OPT:REF helloworld.dll - 0 error(s), 12 warning(s)
He is worroed about this warning LINK : warning LNK4089: all references to "pd.dll" discarded by /OPT:REF q
He does not know what that means
Once the dll is created he places it in the right location, tries to instantiate it on pd and he gets :
helloworld ... couldn't create
thats all info I could get from him, thanks for any help.
enrike
altern wrote:
hi
i was asking about creating an external on windows few weeks ago, here i am again, now i have detailed info about the error the engineer from my uni is getting. He says he is using microsoft dev estydio 6.0 and pd.lib library to try to compile the "hello world" example. The source code is
#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,(t_atomtype)0); // He tenido que hacer este para que el compilador no me de error class_addbang(helloworld_class, helloworld_bang); }
It's a good idea to declare all functions static except for the setup function to avoid "polluting the namespace".
he does not get error but some warnings when compiling:
compiling... hello.cpp C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(71) : warning C4091: 'extern ' : ignored on left of 'struct _array' when no variable is declared
This happens because MSW was not #defined.
C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(141) : warning C4091: 'extern ' : ignored on left of 'struct _class' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(144) : warning C4091: 'extern ' : ignored on left of 'struct _outlet' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(147) : warning C4091: 'extern ' : ignored on left of 'struct _inlet' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(150) : warning C4091: 'extern ' : ignored on left of 'struct _binbuf' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(153) : warning C4091: 'extern ' : ignored on left of 'struct _clock' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(156) : warning C4091: 'extern ' : ignored on left of 'struct _outconnect' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(159) : warning C4091: 'extern ' : ignored on left of 'struct _glist' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(381) : warning C4091: 'extern ' : ignored on left of 'struct _widgetbehavior' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(384) : warning C4091: 'extern ' : ignored on left of 'struct _parentwidgetbehavior' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h(571) : warning C4091: 'extern ' : ignored on left of 'struct _garray' when no variable is declared Linking... LINK : warning LNK4089: all references to "pd.dll" discarded by /OPT:REF helloworld.dll - 0 error(s), 12 warning(s)
It probably means that because MSW was not defined, the symbols from pd.dll were not exported. Also you should link against pd.lib, not pd.dll.
He is worroed about this warning LINK : warning LNK4089: all references to "pd.dll" discarded by /OPT:REF q
He does not know what that means
Once the dll is created he places it in the right location, tries to instantiate it on pd and he gets :
helloworld ... couldn't create
Start by defining MSW in the preprocessor defines part of the project.
Martin
On Dec 17, 2007, at 6:10 AM, Martin Peach wrote:
altern wrote:
hi
i was asking about creating an external on windows few weeks ago,
here i am again, now i have detailed info about the error the engineer
from my uni is getting. He says he is using microsoft dev estydio 6.0 and
pd.lib library to try to compile the "hello world" example. The source
code is#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,(t_atomtype)0); // He tenido que hacer este para que el compilador no me de error class_addbang(helloworld_class, helloworld_bang); }
It's a good idea to declare all functions static except for the setup function to avoid "polluting the namespace".
he does not get error but some warnings when compiling:
compiling... hello.cpp C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (71) : warning C4091: 'extern ' : ignored on left of 'struct _array'
when no variable is declaredThis happens because MSW was not #defined.
C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (141) : warning C4091: 'extern ' : ignored on left of 'struct _class'
when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (144) : warning C4091: 'extern ' : ignored on left of 'struct _outlet'
when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (147) : warning C4091: 'extern ' : ignored on left of 'struct _inlet'
when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (150) : warning C4091: 'extern ' : ignored on left of 'struct _binbuf'
when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (153) : warning C4091: 'extern ' : ignored on left of 'struct _clock'
when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (156) : warning C4091: 'extern ' : ignored on left of 'struct _outconnect' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (159) : warning C4091: 'extern ' : ignored on left of 'struct _glist'
when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (381) : warning C4091: 'extern ' : ignored on left of 'struct
_widgetbehavior' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (384) : warning C4091: 'extern ' : ignored on left of 'struct _parentwidgetbehavior' when no variable is declared C:\Archivos de programa\Microsoft Visual Studio\VC98\INCLUDE\m_pd.h (571) : warning C4091: 'extern ' : ignored on left of 'struct _garray'
when no variable is declared Linking... LINK : warning LNK4089: all references to "pd.dll" discarded by / OPT:REF helloworld.dll - 0 error(s), 12 warning(s)It probably means that because MSW was not defined, the symbols from pd.dll were not exported. Also you should link against pd.lib, not
pd.dll.He is worroed about this warning LINK : warning LNK4089: all
references to "pd.dll" discarded by /OPT:REF qHe does not know what that means
Once the dll is created he places it in the right location, tries to instantiate it on pd and he gets :
helloworld ... couldn't create
Start by defining MSW in the preprocessor defines part of the project.
Every Windows compiler will automatically define _WIN32 so that's the
preferred macro to use. MSW is a Pd-specific thing.
.hc
Access to computers should be unlimited and total. - the hacker ethic
Hans-Christoph Steiner wrote:
On Dec 17, 2007, at 6:10 AM, Martin Peach wrote:
Start by defining MSW in the preprocessor defines part of the project.
Every Windows compiler will automatically define _WIN32 so that's the
preferred macro to use. MSW is a Pd-specific thing.
The version of m_pd.h in cvs still has #ifdef MSW all over it, and no mention of _WIN32, so it wouldn't work unless someone puts
#ifdef _WIN32 #define MSW #endif
at the top of m_pd.h ...or change MSW to _WIN32 throughout the pd source and externals.
Martin
On Dec 18, 2007, at 10:02 PM, Martin Peach wrote:
Hans-Christoph Steiner wrote:
On Dec 17, 2007, at 6:10 AM, Martin Peach wrote:
Start by defining MSW in the preprocessor defines part of the
project.Every Windows compiler will automatically define _WIN32 so that's
the preferred macro to use. MSW is a Pd-specific thing.The version of m_pd.h in cvs still has #ifdef MSW all over it, and
no mention of _WIN32, so it wouldn't work unless someone puts#ifdef _WIN32 #define MSW #endif
at the top of m_pd.h ...or change MSW to _WIN32 throughout the pd source and externals.
Miller was convinced to use __APPLE__ and __linux__, but for some
reason I don't understand, he is averse to using _WIN32. (AFAIK MSVC
and gcc have used _WIN32 since the mid 90's, if not longer).
I submitted patches to convert things to __APPLE__ and that was
accepted. The patch for _WIN32 was not. You could try submitting
one again...
.hc
http://at.or.at/hans/