<div dir="ltr"><div>Arf... Indeed that was my problem. I didn't define the exported function manually at linking time (using /export with the cl) but directly in the C file using PD_INTERNAL because the approach is similar to the one presented in the MSCV documentation to create dll (<a href="https://msdn.microsoft.com/en-us/library/ms235636.aspx">https://msdn.microsoft.com/en-us/library/ms235636.aspx</a>) and it worked pretty well until now... <br></div><div><br></div><div>So to solve my problem, I have two solution: using my own EXPORT definition or generating dynamically the name of the function to export with CMake. Thanks a lot! </div><div>PS: I still don't understand why it worked for some symbols but not for other...  </div><div><br></div><div>Thanks a lot !</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-05-23 15:24 GMT+02:00 Christof Ressi <span dir="ltr"><<a href="mailto:christof.ressi@gmx.at" target="_blank">christof.ressi@gmx.at</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">so I hope you're not putting EXTERN in front of your external's setup function and defining PD_INTERNAL yourself... that wouldn't be a good idea :-) <br>
<br>
> Gesendet: Mittwoch, 23. Mai 2018 um 15:15 Uhr<br>
<span class="">> Von: "Christof Ressi" <<a href="mailto:christof.ressi@gmx.at">christof.ressi@gmx.at</a>><br>
> An: "Pierre Guillot" <<a href="mailto:guillotpierre6@gmail.com">guillotpierre6@gmail.com</a>><br>
</span>> Cc: pd-dev <<a href="mailto:pd-dev@lists.iem.at">pd-dev@lists.iem.at</a>><br>
> Betreff: Re: [PD-dev] pd.lib & msvc - missing symbols<br>
<div><div class="h5">><br>
> > and so **PD_INTERNAL** must also be used if we want to export properly the function `setup_class()` using **EXTERN**. <br>
> <br>
> with 'setup_class()' you mean the setup function of your external? it is exported with the /export:testobj_setup option to the linker.<br>
> <br>
> when you build an external, PD_INTERNAL must *not* be defined because you want to *import* the API functions from Pd.<br>
> <br>
> otoh, PD_INTERNAL must be defined if you build the pd.dll with MSVC, because there you want to *export* the API functions.<br>
>  <br>
> <br>
> Gesendet: Mittwoch, 23. Mai 2018 um 14:09 Uhr<br>
> Von: "Pierre Guillot" <<a href="mailto:guillotpierre6@gmail.com">guillotpierre6@gmail.com</a>><br>
> An: "Christof Ressi" <<a href="mailto:christof.ressi@gmx.at">christof.ressi@gmx.at</a>><br>
> Cc: pd-dev <<a href="mailto:pd-dev@lists.iem.at">pd-dev@lists.iem.at</a>><br>
> Betreff: Re: Re: [PD-dev] pd.lib & msvc - missing symbols<br>
> <br>
> Hi Christof,<br>
>  <br>
> I'm not a specialist of Windows so I can miss something important. <br>
> How do you specify the target machine? Are you sure you compiled against the 64bit version of pd.lib? <br>
> Because I didn't check the symbols of the 32 bit distribution, perhaps they are available. <br>
>  <br>
> Another question: I assumed that **_WIN32** must be defined (isn't it?) and so **PD_INTERNAL** must also be used if we want to export properly the function `setup_class()` using **EXTERN**. <br>
> I see that you don't define any of these constants, are they useless in your case? And why? <br>
>  <br>
>  <br>
> 2018-05-23 13:40 GMT+02:00 Christof Ressi <<a href="mailto:christof.ressi@gmx.at">christof.ressi@gmx.at</a>[mailto:<a href="mailto:christof.ressi@gmx.at"><wbr>christof.ressi@gmx.at</a>]>:this is odd. I made a simple Pd external which uses s_list and s_signal with MSVC in two versions:<br>
> one links against Miller's pd.lib, the other links against the pd.lib I get when building from source with MinGW and autotools.<br>
> Both versions compile, link and load just fine with either Pd version.<br>
> <br>
> I'm using the Developer command prompt, these are my commands:<br>
> <br>
> > cl /W3 /DNT /DPD /nologo /I. /IPDSOURCEPATH /c testobj.c<br>
> > link /dll /export:testobj_setup testobj.obj oldnames.lib kernel32.lib PDBINPATH\pd.lib<br>
> <br>
> Christof<br>
>  <br>
> <br>
> Gesendet: Mittwoch, 23. Mai 2018 um 12:01 Uhr<br>
> Von: "Pierre Guillot" <<a href="mailto:guillotpierre6@gmail.com">guillotpierre6@gmail.com</a>[<wbr>mailto:<a href="mailto:guillotpierre6@gmail.com">guillotpierre6@gmail.<wbr>com</a>]><br>
> An: "IOhannes m zmoelnig" <<a href="mailto:zmoelnig@iem.at">zmoelnig@iem.at</a>[mailto:<a href="mailto:zmoelnig@iem.at">zmoeln<wbr>ig@iem.at</a>]><br>
> Cc: pd-dev <<a href="mailto:pd-dev@lists.iem.at">pd-dev@lists.iem.at</a>[mailto:<a href="mailto:pd-dev@lists.iem.at">pd<wbr>-dev@lists.iem.at</a>]><br>
> Betreff: Re: [PD-dev] pd.lib & msvc - missing symbols<br>
> <br>
> > however, it would be nice if the shipped pd.lib (which uses the MinGW<br>
> > toolchain and doesn't have the MSVC tools) would contain all the<br>
> > required symbols.<br>
>  <br>
> Yes, what seems strange is that s_list and s_signal were defined in the shipped pd.def but not in pd.lib...<br>
>  <br>
> > otoh, i do think that those global variables (`e.g. `s_float`) shouldn't<br>
> > be used in the first place: use the `gensym()` equivalents.<br>
>  <br>
> <br>
> Why? <br>
> I used these variable because I assumed that they are more efficient than using `gensym()` (and as they are defined EXTERN I also assumed that they can be used). <br>
> But yes perhaps a better solution would be to generate and store the symbols in the new method of the object using `gensym()` (and it will be the same but for the sustainability of old codes, these symbols must be included).<br>
>  <br>
> Thanks<br>
>  <br>
> 2018-05-23 11:38 GMT+02:00 IOhannes m zmoelnig <<a href="mailto:zmoelnig@iem.at">zmoelnig@iem.at</a>[mailto:<a href="mailto:zmoelnig@iem.at">zmoeln<wbr>ig@iem.at</a>][mailto:<a href="mailto:zmoelnig@iem.at">zmoelnig@<wbr>iem.at</a>[mailto:<a href="mailto:zmoelnig@iem.at">zmoelnig@iem.at</a>]<wbr>]>:On 2018-05-23 11:29, Pierre Guillot wrote:<br>
> > But there are missing symbols: on Windows<br>
> > 64bit I can't use s_list and s_signal for example. I solved the issue by<br>
> > creating my own pd.lib and pd.def from pd.dll. So if you encounter the same<br>
> > issue, you can simply do<br>
> ><br>
> >> dumpbin /EXPORTS pd.dll > pd.exports<br>
> >> lib /def:pd.def /out:pd.lib<br>
> <br>
> the problem with this is that it requires MSVC tools<br>
> now, the target audience are MSVC-users (who else needs that pd.lib...),<br>
> so they already have it.<br>
> however, it would be nice if the shipped pd.lib (which uses the MinGW<br>
> toolchain and doesn't have the MSVC tools) would contain all the<br>
> required symbols.<br>
> <br>
> otoh, i do think that those global variables (`e.g. `s_float`) shouldn't<br>
> be used in the first place: use the `gensym()` equivalents.<br>
> <br>
> gasdmr<br>
> IOhannes<br>
> <br>
> > I hope it could help some of you. Perhaps we could add a documentation<br>
> > somewhere about it... (I don't know if it useful...) I can help if needed.<br>
> <br>
> <br>
> <br>
>  <br>
> ______________________________<wbr>_________________<br>
> Pd-dev mailing list<br>
> <a href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a>[mailto:<a href="mailto:Pd-dev@lists.iem.at">Pd-<wbr>dev@lists.iem.at</a>][mailto:<a href="mailto:Pd-dev@lists.iem.at">Pd-<wbr>dev@lists.iem.at</a>[mailto:<a href="mailto:Pd-dev@lists.iem.at">Pd-<wbr>dev@lists.iem.at</a>]]<br>
> <a href="https://lists.puredata.info/listinfo/pd-dev[https://lists.puredata.info/listinfo/pd-dev]" rel="noreferrer" target="_blank">https://lists.puredata.info/<wbr>listinfo/pd-dev[https://lists.<wbr>puredata.info/listinfo/pd-dev]</a><br>
>  _____________________________<wbr>__________________ Pd-dev mailing list <a href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a>[mailto:<a href="mailto:Pd-dev@lists.iem.at">Pd-<wbr>dev@lists.iem.at</a>] <a href="https://lists.puredata.info/listinfo/pd-dev[https://lists.puredata.info/listinfo/pd-dev]" rel="noreferrer" target="_blank">https://lists.puredata.info/<wbr>listinfo/pd-dev[https://lists.<wbr>puredata.info/listinfo/pd-dev]</a><br>
> <br>
> ______________________________<wbr>_________________<br>
> Pd-dev mailing list<br>
> <a href="mailto:Pd-dev@lists.iem.at">Pd-dev@lists.iem.at</a><br>
</div></div>> <a href="https://lists.puredata.info/listinfo/pd-dev" rel="noreferrer" target="_blank">https://lists.puredata.info/<wbr>listinfo/pd-dev</a><br>
><br>
</blockquote></div><br></div>