<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 9, 2016 at 9:54 PM, Pierre Guillot <span dir="ltr"><<a href="mailto:guillotpierre6@gmail.com" target="_blank">guillotpierre6@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8px">Hi all,</span><br><div><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">I'm working on a plugin that dynamically loads PD patches. Everything works fine, I even manage the multiple instances issue. You can take a look at it if you want : <a href="https://github.com/pierreguillot/Camomile" target="_blank">https://github.com/pierreguillot/Camomile</a>. My problem is that the plugin can't load dynamically the external libraries (I tried with freeverb~ and other libraries and I got : Symbol not found: _s_signal</span></div><div><span style="font-size:12.8px">  Referenced from: /Users/Pierre/GitHub/Camomile/Patches/freeverb~.pd_darwin</span></div><div><span style="font-size:12.8px">  Expected in: flat namespace). </span></div><div><span style="font-size:12.8px">I don't have any linker flag and I set up this set of macros for the preprocessor:</span></div><div><span style="font-size:12.8px">PD=1</span></div><div><span style="font-size:12.8px">HAVE_UNISTD_H=1</span></div><div><span style="font-size:12.8px">USEAPI_DUMMY=1</span></div><div><span style="font-size:12.8px">HAVE_ALLOCA_H=1</span></div><div><span style="font-size:12.8px">HAVE_LIBDL=1</span></div><div><span style="font-size:12.8px">PD_INTERNAL=1</span></div><div><span style="font-size:12.8px">I use Xcode 7.2.1 with LLVM and OSX 10.9 for the deployment target (required for c++11 support). I going to try on Linux but if anybody has a clue for Mac I would be grateful (I must use Xcode because it's a JUCE project).</span></div><div><span style="font-size:12.8px"><br></span></div></div></div></blockquote><div><br></div><div>libpds has the same problem. If I remember correctly, the problem</div><div>is that you have to link your plugin with RTLD_GLOBAL in order</div><div>for your externals to see the symbols, but you</div><div>don't control how the host loads your plugin. But even if you could</div><div>(and you probably can if you make a wrapper plugin that loads your</div><div>actual plugin), it wouldn't work very well since you would get lots</div><div>of symbol clash when trying to load a second instance of your plugin.</div><div><br></div><div>So what I did in libpds was to statically link all externals (in pd extended)</div><div>into libpds [1]. Of course, that's not exactly a perfect solution, but it's a lot better</div><div>than not being able to use any external.</div><div><br></div><div>Maybe it's possible to create your own linker system that somehow fixes</div><div>it though, I don't know.</div><div><br></div><div>[1] <a href="https://github.com/kmatheussen/libpd/blob/master/make.scm">https://github.com/kmatheussen/libpd/blob/master/make.scm</a><br></div><div><br></div><div><br></div></div></div></div>