[LAD] suil error: Unable to open UI library

Cedric Roux sed at free.fr
Thu Oct 16 13:08:04 UTC 2014

On 10/16/2014 12:53 PM, Phil CM wrote:
> Oh Mon Dieu, it works. Cedric, thank you very much for your light. All
> those infos are exactly what I needed ;
> Those atrocious begginer errors were hard to spot, let alone correct,
> and I find it hard to thank you enough to have taken the time to put me
> back on track.
> Now I need to learn waf to get it to build this :)

good luck...
let's not troll...

But wait!
I now know why it failed.
static LV2_Descriptor kis_Descriptor= {
should be in kis.c, not kis.h
(put it right after #include "kis.h")

and then cleaning stuff (rm -rf build/*) and compiling again
pops up a window with jalv.gtk.

Putting the kis_Descriptor in kis.h file means that
every file that includes kis.h will declare kis_Descriptor.
In your case you really had 2 kis_Descriptor structures,
one in kis.so and one in kis_gui.so. Since you build
a .so file (shared library), gcc accepts to create it
even if instantiateSO_404 does not exist at compilation
time. At runtime though, every symbol must be defined,
which is not the case here, leading to, well, failure.

Generally (in your beginner case: always) you *declare*
types and functions (declaration, not definition) in .h
files and *define* functions and global variables in .c (or .cpp
for c++) files. The .h is there to share definitions between
various c/c++ source files. (For a function, a "declaration"
is just "int toto(int x);" with no associated code. A "definition"
is "int toto(int x) { return x; }" you see, with actual code.
(You can do that with global variables too, but global
variables are a bad idea. Forget about those for the moment.)

Ah, and because you create a .so file, some special attention
is required with your definitions. With the "static" keyword
put in front of functions and global variables, you "hide"
those from the rest of the world. You want to do that for
all the functions and variables, except in your case
the functions "lv2_descriptor" and "lv2ui_descriptor"
which will be called by the host of your plugin.

Now if your project has more than one source file, you can't
use static (say file a.c calls a function in b.c). Then I
don't know. Maybe there is some linker magic to be specific
at what symbols must be exported. If someone knows...
(my friend laziness is calling me so hard! crazy little
beast deep inside my brain... wait! I'm coming!)


More information about the Linux-audio-dev mailing list