Discussion:
A question about Cmus
talvi
2014-07-31 23:33:37 UTC
Permalink
I apologize if this isn't the right place to ask this, but I couldn't
think of another way,

I'm a Cmus user and I'm studying the source code. I'm a beginner
programmer and there is something I am trying to understand;

I've noticed that starting from version 1.5.0, as noted on the
changelog: 'dynamically loadable plugins'. It seems that the input and
output plugins (for example vorbis.c for input and alsa.c for output)
are compiled into dynamically loadable libraries (.so files), and then
they are loaded using the dlopen function, then put in a doubly-linked
list.

What I want to understand is, why is this technique used, instead of
just turning those sources files to object code and then linking them
into the executable? Is it for performance, or to reduce the memory
usage or something else?

Thanks for your time.
Johannes Lange
2014-08-01 06:18:21 UTC
Permalink
Hi,

this way of loading libraries gives the flexibility to load them at
runtime if they are available.
Especially you dont't have to re-link the whole executable if you want
to add a plugin.

Cheers,
Johannes

On Fri 01 Aug 2014 01:33:37 CEST,
Post by talvi
I apologize if this isn't the right place to ask this, but I couldn't
think of another way,
I'm a Cmus user and I'm studying the source code. I'm a beginner
programmer and there is something I am trying to understand;
I've noticed that starting from version 1.5.0, as noted on the
changelog: 'dynamically loadable plugins'. It seems that the input and
output plugins (for example vorbis.c for input and alsa.c for output)
are compiled into dynamically loadable libraries (.so files), and then
they are loaded using the dlopen function, then put in a doubly-linked
list.
What I want to understand is, why is this technique used, instead of
just turning those sources files to object code and then linking them
into the executable? Is it for performance, or to reduce the memory
usage or something else?
Thanks for your time.
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
Gregory Petrosyan
2014-08-01 06:50:04 UTC
Permalink
Post by talvi
What I want to understand is, why is this technique used, instead of
just turning those sources files to object code and then linking them
into the executable? Is it for performance, or to reduce the memory
usage or something else?
I think important use case are distributions which can ship compiled
plugins in separate packages from cmus itself.

Gregory

Loading...