Re: [PD] externals tutorial: link error

2011-02-19 Thread IOhannes m zmölnig
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 02/18/2011 11:04 PM, Elliott Slaughter wrote:
> 
> Thanks. The MSW fix worked. Funny that m_pd.h can't figure that out
> automatically

???
m_pd.h is a file that cannot do anything on it's own.

also, this file is only used during the compilation stage, whereas your
problem comes from the linker stage.

linking on windows is usually very restrictive, in that it requires the
developer to explicitely define what they want to export (when writing
dllS) or what they want to import (when using dllS)

this requirement obviously counteracts the idea of "m_pd.h" (or anything
else) to _automatically_ figure it out.

two more things:
- - when using __declspec() you should _always_ use MACROs, in order to
make porting (and maintainance) easiert. look at the "EXTERN" definition
in m_pd.h how Pd does this.

- - you can also tell the linker directly which symbols you want to
export. e.g, using M$VC's you can add a linker flag like
"/export:foo_setup", which will make the "foo_setup" function accessible
by Pd.

fgmadr
IOhannes
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1foMUACgkQkX2Xpv6ydvQGfACgybLPfdw/Vq02JJzP6nf2Xi7T
R2oAoJfdc14q+H3H+wFPSNXnl+7jDmbR
=dkPM
-END PGP SIGNATURE-

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] externals tutorial: link error

2011-02-18 Thread Elliott Slaughter
On Fri, Feb 18, 2011 at 12:03 PM, Martin  wrote:

> On 18/02/11 02:39 PM, Elliott Slaughter wrote:
>
>> I'm getting a link error when following the counter tutorial from the
>> following page:
>>
>> http://pdstatic.iem.at/externals-HOWTO/node4.html
>>
>> 2>counter.obj : error LNK2001: unresolved external symbol _s_float
>> 2>C:\Users\Elliott\...\externals\build\Debug\counter.dll : fatal error
>> LNK1120: 1 unresolved externals
>>
>>
> I think it's because you need to define MSW in the preprocessor defines
> section so that "EXPORT" in m_pd.h is replaced by "__declspec(dllimport)".
> Otherwise it's just "extern" and the linker can't find it.
> Another way to avoid that error is to replace any ocurrence of &s_float
> with gensym("float") but then you'll probably run into more trouble down the
> line.


Thanks. The MSW fix worked. Funny that m_pd.h can't figure that out
automatically

-- 
Elliott Slaughter

"Don't worry about what anybody else is going to do. The best way to predict
the future is to invent it." - Alan Kay
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] externals tutorial: link error

2011-02-18 Thread Jack
Oups, sorry, i think it was an error concerning the web link to the how
to.
++

Jack



Le vendredi 18 février 2011 à 15:03 -0500, Martin a écrit :
> On 18/02/11 02:39 PM, Elliott Slaughter wrote:
> > I'm getting a link error when following the counter tutorial from the 
> > following page:
> >
> > http://pdstatic.iem.at/externals-HOWTO/node4.html
> >
> > 2>counter.obj : error LNK2001: unresolved external symbol _s_float
> > 2>C:\Users\Elliott\...\externals\build\Debug\counter.dll : fatal error 
> > LNK1120: 1 unresolved externals
> >
> 
> I think it's because you need to define MSW in the preprocessor defines 
> section so that "EXPORT" in m_pd.h is replaced by 
> "__declspec(dllimport)". Otherwise it's just "extern" and the linker 
> can't find it.
> Another way to avoid that error is to replace any ocurrence of &s_float 
> with gensym("float") but then you'll probably run into more trouble down 
> the line.
> 
> Martin
> 
> 
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list



signature.asc
Description: This is a digitally signed message part
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] externals tutorial: link error

2011-02-18 Thread Martin

On 18/02/11 02:39 PM, Elliott Slaughter wrote:
I'm getting a link error when following the counter tutorial from the 
following page:


http://pdstatic.iem.at/externals-HOWTO/node4.html

2>counter.obj : error LNK2001: unresolved external symbol _s_float
2>C:\Users\Elliott\...\externals\build\Debug\counter.dll : fatal error 
LNK1120: 1 unresolved externals




I think it's because you need to define MSW in the preprocessor defines 
section so that "EXPORT" in m_pd.h is replaced by 
"__declspec(dllimport)". Otherwise it's just "extern" and the linker 
can't find it.
Another way to avoid that error is to replace any ocurrence of &s_float 
with gensym("float") but then you'll probably run into more trouble down 
the line.


Martin


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] externals tutorial: link error

2011-02-18 Thread Jack
Try here :
http://iem.at/pd/externals-HOWTO/
++

Jack



Le vendredi 18 février 2011 à 11:39 -0800, Elliott Slaughter a écrit :
> I'm getting a link error when following the counter tutorial from the
> following page:
> 
> 
> http://pdstatic.iem.at/externals-HOWTO/node4.html
> 
> 
> 2>counter.obj : error LNK2001: unresolved external symbol _s_float
> 2>C:\Users\Elliott\...\externals\build\Debug\counter.dll : fatal error
> LNK1120: 1 unresolved externals
> 
> 
> I got the first (hello world) example to build and link and run, so
> I'm not sure what I'm doing wrong here. I am definitely linking
> against pd.lib, because if I stop linking against it, I get about 8
> link errors instead of 1. My code is identical to the example except
> for an added extern "C" and __declspec(dllexport) to get the
> counter_setup function to have the correct visibility.
> 
> 
> I am building with MS Visual Studio 2010 and the Pd 0.42.5
> from http://www.crca.ucsd.edu/~msp/software.html .
> 
> 
> I would be happy to provide more details on my code and build system
> if that would be helpful.
> 
> 
> Thanks in advance.
> 
> -- 
> Elliott Slaughter
> 
> "Don't worry about what anybody else is going to do. The best way to
> predict the future is to invent it." - Alan Kay
> 
> ___
> Pd-list@iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> http://lists.puredata.info/listinfo/pd-list



signature.asc
Description: This is a digitally signed message part
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list