[PD] creating external on windows (again)
Hans-Christoph Steiner
hans at eds.org
Wed Dec 19 00:55:29 CET 2007
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 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.
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
More information about the Pd-list
mailing list