<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 15/10/14 20:17, Paul Davis wrote:<br>
    </div>
    <blockquote
cite="mid:CAFa_cKn0se_VtKyEX6h4B9URvgahKf3ExvhWu5-nW8Do56+1og@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Wed, Oct 15, 2014 at 2:24 PM, Phil
            CM <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:philcm@gnu.org" target="_blank">philcm@gnu.org</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">Hello LADs<br>
              <br>
              I'm trying to make a GUI for a LV2 synth based on so-404.
              In fact, I'm trying to learn C / C++.<br>
              <br>
              I got everything to build OK, but I'm stuck on a hard to
              read execution error ; when I load the plugin in jalv, it
              loads it OK, but fails to load the UI and says :<br>
              <br>
              suil error: Unable to open UI library
              /usr/local/lib/lv2/kis.lv2/kis_gui.so
              (/usr/local/lib/lv2/kis.lv2/kis_gui.so: undefined symbol:
              _Z17instantiateSO_404PK15_LV2_DescriptordPKcPKPK12_LV2_Feature)<br>
            </blockquote>
            <div><br>
              <br>
              % echo
              _Z17instantiateSO_404PK15_LV2_DescriptordPKcPKPK12_LV2_Feature
              | c++filt <br>
              instantiateSO_404(_LV2_Descriptor const*, double, char
              const*, _LV2_Feature const* const*)<br>
              % <br>
              <br>
            </div>
            <div>your plugin is missing a symbol
              (instantiateSO_404(...)), apparently.<br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    The problem seems to be different implementations of instantiate().
    <br>
    <br>
    In <a
href="https://github.com/harryhaaren/lv2/tree/master/plugins/eg-sinsynth.lv2">Harry's
      example</a>, the methods that (AFAIU) LV2 expects :<br>
    <ul>
      <li><tt>instantiate()</tt></li>
      <li><tt>connect_port()</tt></li>
      <li><tt>activate()</tt></li>
      <li><tt>run()</tt></li>
      <li><tt>deactivate()</tt></li>
      <li><tt>cleanup()</tt></li>
      <li><tt>extension_data()</tt></li>
    </ul>
    Are declared explicitely, using static.<br>
    <br>
    Like this :<br>
    <br>
    <tt>static LV2_Handle</tt><tt><br>
    </tt><tt><font color="#cc0000">instantiate</font>(const
      LV2_Descriptor*     descriptor,</tt><tt><br>
    </tt><tt>            double                    rate,</tt><tt><br>
    </tt><tt>            const char*               bundle_path,</tt><tt><br>
    </tt><tt>            const LV2_Feature* const* features)</tt><tt><br>
    </tt><tt>{</tt><tt><br>
    </tt><tt>  SinSynth* self = (SinSynth*)malloc(sizeof(SinSynth));</tt><tt><br>
    </tt><tt><br>
    </tt><tt>  // store the sample rate in "self" so we can retrieve it
      in run()</tt><tt><br>
    </tt><tt>  self->sample_rate = rate;</tt><tt><br>
    </tt><tt><br>
    </tt><tt>  // initialize the phase so we start at the beginning of
      the wave</tt><tt><br>
    </tt><tt>  self->phase = 0.f;</tt><tt><br>
    </tt><tt><br>
    </tt><tt>  return self;</tt><tt><br>
    </tt><tt>}</tt><tt><br>
    </tt><tt><br>
    </tt><tt>void</tt><tt><br>
    </tt><tt><font color="#cc0000">connect_port</font>(LV2_Handle
      instance,</tt><tt><br>
    </tt><tt>             uint32_t   port,</tt><tt><br>
    </tt><tt>             void*      data)</tt><tt><br>
    </tt><tt>{</tt><tt><br>
    </tt><tt>  SinSynth* self=(SinSynth*)instance;</tt><tt><br>
    </tt><tt><br>
    </tt><tt>  switch (port) {</tt><tt><br>
    </tt><tt>  case AMP_FREQ:</tt><tt><br>
    </tt><tt>    self->freq = (float*)data;</tt><tt><br>
    </tt><tt>    break;</tt><tt><br>
    </tt><tt>  case AMP_MIDI:</tt><tt><br>
    </tt><tt>    self->MidiIn = data;</tt><tt><br>
    </tt><tt>    break;</tt><tt><br>
    </tt><tt>  case AMP_OUTPUT:</tt><tt><br>
    </tt><tt>    self->output = (float*)data;</tt><tt><br>
    </tt><tt>    break;</tt><tt><br>
    </tt><tt>  }</tt><tt><br>
    </tt><tt>}</tt><tt><br>
    </tt><tt><br>
    </tt><tt>static void</tt><tt><br>
    </tt><tt><font color="#cc0000">activate</font>(LV2_Handle instance)</tt><tt><br>
    </tt><tt>{</tt><tt><br>
    </tt><tt>}</tt><tt><br>
    </tt><br>
    (...)<br>
    <br>
    Whereas in so-404, they are somehow "surcharged", like this :<br>
    <br>
    <tt>void runSO_404( LV2_Handle arg, uint32_t nframes );</tt><tt><br>
    </tt><tt>LV2_Handle instantiateSO_404(const LV2_Descriptor
      *descriptor,double s_rate, const char *path,const LV2_Feature *
      const* features);</tt><tt><br>
    </tt><tt>void cleanupSO_404(LV2_Handle instance);</tt><tt><br>
    </tt><tt>void connectPortSO_404(LV2_Handle instance, uint32_t port,
      void *data_location);</tt><tt><br>
    </tt><tt><br>
    </tt><tt>static LV2_Descriptor kis_Descriptor= {</tt><tt><br>
    </tt><tt>    .URI=<a class="moz-txt-link-rfc2396E" href="https://bitbucket.org/xaccrocheur/kis">"https://bitbucket.org/xaccrocheur/kis"</a>,</tt><tt><br>
    </tt><tt>    .instantiate=instantiateSO_404,</tt><tt><br>
    </tt><tt>    .connect_port=connectPortSO_404,</tt><tt><br>
    </tt><tt>    .activate=NULL,</tt><tt><br>
    </tt><tt>    .run=runSO_404,</tt><tt><br>
    </tt><tt>    .deactivate=NULL,</tt><tt><br>
    </tt><tt>    .cleanup=cleanupSO_404,</tt><tt><br>
    </tt><tt>    .extension_data=NULL,</tt><tt><br>
    </tt><tt>};</tt><br>
    <br>
    So apparently instead of being declared thusly:<br>
    <tt><br>
    </tt><tt>LV2_Handle</tt><tt><br>
    </tt><tt>instantiateSO_404(const LV2_Descriptor* descriptor,</tt><tt><br>
    </tt><tt>                  double s_rate,</tt><tt><br>
    </tt><tt>                  const char *path,</tt><tt><br>
    </tt><tt>                  const LV2_Feature * const* features)</tt><tt><br>
    </tt><tt>{...}</tt><br>
    <br>
    Either my instantiate method return value should be static, or my
    "mandatory" methods should be declared explicitely. I tried to adapt
    them, but failed so far.<br>
    Please excuse my sub-newbie mistakes.<br>
    <br>
    <br>
    --Phil<br>
    <br>
    <br>
    <br>
    <blockquote
cite="mid:CAFa_cKn0se_VtKyEX6h4B9URvgahKf3ExvhWu5-nW8Do56+1og@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Linux-audio-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Linux-audio-dev@lists.linuxaudio.org">Linux-audio-dev@lists.linuxaudio.org</a>
<a class="moz-txt-link-freetext" href="http://lists.linuxaudio.org/listinfo/linux-audio-dev">http://lists.linuxaudio.org/listinfo/linux-audio-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>