The QPluginLoader class does not provide a method for loading the Qt plugin from a QByteArray. How can I load the plugin from a QByteArray?
The plugins are in my case sent over stdin to the program. That is why they are not available as files.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could first save the QByteArray to a QTemporaryFile and then load it with QPluginLoader
Unfortunately this might not work if you have more than one plugin and need to run our function load_plugin_from_bytearray multiple times, as QTemporaryFile might by chance be reusing the same file path for the temporary files and QPluginLoader is caching its loaded plugins. I need to investigate this more. Anyway, you could circumvent that problem by making the temporary file paths unique by providing a different
templateNamefor each QTemporaryFileQTemporaryFile::QTemporaryFile(const QString & templateName)