highgui: force loading of imgcodecs module

- required for plugins on Linux (they use imwrite, but there is no link dependency)
This commit is contained in:
Alexander Alekhin 2021-06-09 08:34:58 +00:00
parent 76e9da3fe9
commit 3e538355e2

View File

@ -232,8 +232,12 @@ std::vector<FileSystemPath_t> getPluginCandidates(const std::string& baseName)
return results; return results;
} }
// NB: require loading of imgcodecs module
static void* g_imwrite = (void*)imwrite;
void PluginUIBackendFactory::loadPlugin() void PluginUIBackendFactory::loadPlugin()
{ {
CV_Assert(g_imwrite);
for (const FileSystemPath_t& plugin : getPluginCandidates(baseName_)) for (const FileSystemPath_t& plugin : getPluginCandidates(baseName_))
{ {
auto lib = std::make_shared<cv::plugin::impl::DynamicLib>(plugin); auto lib = std::make_shared<cv::plugin::impl::DynamicLib>(plugin);