Skip to content

clap_plugin_factory functions take itself as a parameter? #243

Answered by defiantnerd
rokit asked this question in Q&A
Discussion options

You must be logged in to vote

It is possible to have several factories and you might need to address the factory, imagine it as a "this" pointer. The parameter is not used in the template since it has only one factory, but more complex plugin libraries are possible where the appropriate factory needs to be selected.

In general it is also useful not to have a simple data member but a function which can determine things at runtime (like licenses, dynamic wrappers etc.). This way you can set up the structs as static/const and keep the flexibility without the necessity of code that just prepares structs.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rokit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants