<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>
      <blockquote type="cite">i wonder if this is intentional.
      </blockquote>
      This is really bad. I always thought that the setup() function of
      the *same* library (binary) was guaranteed to be called only once.
      This behavior is surprising and should be fixed IMO.<br>
    </p>
    <p>I've tried [declare -stdlib vstplugin~ -lib vstplugin~] and I get
      a segfault :-/. Now, you could say it's my fault because I don't
      check for double initialization, but I really didn't expect this.</p>
    <p>For most libraries, it is not a big deal, because they only
      register one or more Pd classes, but it is problematic for
      libraries which do some non-trivial initialization in the setup()
      function.<br>
    </p>
    <p>I'll add a quick fix to [vstplugin~] to avoid this situation, but
      we should also think about how to fix this in Pd. One solution
      could be to store and compare the module handle or setup function
      pointer.</p>
    <p>Christof<br>
    </p>
    <div class="moz-cite-prefix">On 11.03.2021 20:33, IOhannes m zmölnig
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:02b9d4bf-6a1c-6ced-cdd2-02ae89dd42ff@iem.at">hi all,
      <br>
      <br>
      i just noticed that declaring a library with *both* '-lib' and
      '-stdlib' will load two libraries (if it can be found in the
      stdpath)
      <br>
      <br>
      e.g. [declare -lib bonk~ -stdlib bonk~]
      <br>
      <br>
      this will load bonk~ twice.
      <br>
      typically it will load the same library twice: once it's found in
      the stdpath, and the other time it's found in the normal paths
      (that include the stdpath).
      <br>
      sometimes two different binaries are loaded, iff the there's a
      library with the same name is also found in a non-stdpath.
      <br>
      <br>
      i wonder if this is intentional.
      <br>
      <br>
      i'm absolutely in favour that "-lib" loads libraries in the
      stdpath.
      <br>
      (i'm just mentioning this, even though i don't think that this is
      actually the issue here)
      <br>
      <br>
      <br>
      typically, libraries are not loaded multiple times and there is
      special code that tries to prevent duplicate loading.
      <br>
      however, this code does not kick in when using both -stdlib and
      -lib.
      <br>
      <br>
      is this intentional?
      <br>
      <br>
      gmfds
      <br>
      IOhannes
      <br>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
<a class="moz-txt-link-abbreviated" href="mailto:Pd-list@lists.iem.at">Pd-list@lists.iem.at</a> mailing list
UNSUBSCRIBE and account-management -> <a class="moz-txt-link-freetext" href="https://lists.puredata.info/listinfo/pd-list">https://lists.puredata.info/listinfo/pd-list</a>
</pre>
    </blockquote>
  </body>
</html>