Buy "plugins" on linux

I am currently developing / hacking a tool to analyze and transform images. Filters in it will be loaded at runtime using dlopen & co.

My question is, where do * nix tools usually install plugins (* .so files) when installed?

bin/program
lib/program/plugins/thisandthat.so

      

may be?

Second, how can I use it and where to place it during development without installing it. (this is probably the tricky part)

I want to avoid shell scripts if possible.

thanks in connection Ronny

+2


source to share


5 answers


The layout seems reasonable. For example, you can search the current directory, look for an environment variable, or a command line switch during development. It depends on the details of your development environment and workflow.



+1


source


Usually / usr / lib / program_name should be a good place



During development, I would create a command line parameter to specify the plugin search path and just leave the plugins in the build-dir file for example.

+5


source


Consider:

/usr/lib/program/*.so

      

+3


source


The File System Hierarchy Standard is a good guide for selection . Most Linux distributions use this standard.

Here's a quick summary.

Put the app binary in: / usr / bin / progname, / usr / local / bin / progname or / opt / progname

Place plugins or library files in: / usr / lib / progname, / usr / local / lib / progname or / opt / progname / lib

Place the host configuration for the application in: / etc / progname or / etc / opt / progname

Place your user config in: $ HOME / .progname

Place the application manual page in: / usr / shar / person / man1 /

There is a separate hierarchical file for / var. Use / var / log / progname for logging as an example.

In response to a comment in a cafe. I find it very helpful to select the target directory at compile time. Using $ PREFIX also makes it easy to separate the devellopment assembly from the shippment. Most use / usr / progname, / usr / lib / progname and / etc / progname

+3


source


Do not forget:

$HOME/.program/

      

+2


source







All Articles