P
P
Pavel K2014-05-31 22:33:19
C++ / C#
Pavel K, 2014-05-31 22:33:19

C++ (Qt) plugins. Pimpl. How to leave a public .h file to hide the class implementation from plugins?

Greetings.
The program uses a plug-in system with interaction through a signal/slot, i.e. I can pass QObject * if necessary.
Now we need a subject.
Those. plugins can include the .h class file, I would like the class implementation (.cpp) to remain unknown for them, since it may change in the future.
Those. simply passing a reference to a class is naturally not suitable.
I am familiar with pimpl, but I can’t adapt it for plugins, and I don’t think it’s quite suitable.
Or will it fit? Is there a code example somewhere?
Or can someone tell me at least in what direction to move?
Or "Son, this is fantastic"?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel K, 2014-06-01
@PavelK

Made.
In a class, function calls go through a wrapper that calls a function pointer.
header:

DB& Exec() { return (this->*exec)(); }
 DB& (DB::*exec)()= &DB::_Exec;
DB& _Exec();

I pass a link to the class to the plugins.
But you have to write each function in three places, but it works.
It may be possible to simplify in the future.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question