Plugin get "The specified module could not be found" error when loading
CompletedHi,
I'm trying to using our library on Nx. I write a yuan_plugin.dll plugin statically link our .dlls. When I restart the server, I got the following error.
Here is all of our dependencies.
-
Hi 高偉恆,
Thanks for your questions, but unfortunately, the information is very limited.
Please provide the debug level server log as well as the sample source code.Thanks.
0 -
Hi Ichiro,
I think my problem is similar to https://support.networkoptix.com/hc/en-us/community/posts/14428807133207-A-custom-video-analytics-plugin this issue.
My plugin is work when I use dynamic link to my dll.
I just call our create function on settingsReceived() and it failed.
nx::sdk::Result<const nx::sdk::ISettingsResponse*> DeviceAgent::settingsReceived()
{
std::map<std::string, std::string> settings = currentSettings();
int count = 5;
DumpDebugMessage("%s config model:%s gpu num:%d", (char*)__func__, settings[kODConfigModelComboBox].c_str(), std::stoi(settings[kODGpuNum].c_str()));
if( od_model_ != settings[kODConfigModelComboBox]) {
od_model_ = settings[kODConfigModelComboBox];
// ------------------------------QDEEP------------------------------
QRESULT result;
if( this->detector_ != nullptr) {
if ( event_num_ != 0 ) {
for ( size_t i = 0; i < event_num_; i++ ) {
QDEEP_DEL_OBJECT_DETECT_EVENT( this->detector_, (unsigned int)i+1 );
//m_pQDEEP_DEL_OBJECT_DETECT_EVENT( this->detector_, (unsigned int)i+1 );
}
}
//result = m_pQDEEP_STOP_OBJECT_DETECT( this->detector_ );
result = QDEEP_STOP_OBJECT_DETECT( this->detector_ );
DumpDebugMessage("QDEEP_STOP_OBJECT_DETECT:%08X", result );
//result = m_pQDEEP_DESTROY_OBJECT_DETECT( this->detector_ );
result = QDEEP_DESTROY_OBJECT_DETECT( this->detector_ );
DumpDebugMessage("QDEEP_DESTROY_OBJECT_DETECT:%08X", result );
this->detector_ = nullptr;
}
std::string model_path = MODEL_PATH_PREFIX + std::get<1>(CONFIG_MODEL_MAP[od_model_]);
result = m_pQDEEP_CREATE_OBJECT_DETECT( GPU_TYPE_MAP[settings[kODGpuTypeComboBox]], std::stoi(settings[kODGpuNum].c_str()) - 1, std::get<0>(CONFIG_MODEL_MAP[od_model_]), (char*)model_path.c_str(), &this->detector_, QDEEP_OBJECT_DETECT_FLAG_TRAJECTORY_TRACKING, NULL);
//result = m_pQDEEP_CREATE_OBJECT_DETECT( GPU_TYPE_MAP[settings[kODGpuTypeComboBox]], std::stoi(settings[kODGpuNum].c_str()) - 1, std::get<0>(CONFIG_MODEL_MAP[od_model_]), (char*)model_path.c_str(), &this->detector_, QDEEP_OBJECT_DETECT_FLAG_TRAJECTORY_TRACKING, NULL);
DumpDebugMessage("GPUType:%d GpuNum:%d model:%d modelpath prefix:%s model name:%s modelpath:%s", GPU_TYPE_MAP[settings[kODGpuTypeComboBox]], std::stoi(settings[kODGpuNum].c_str()), std::get<0>(CONFIG_MODEL_MAP[od_model_]), MODEL_PATH_PREFIX.c_str(), std::get<1>(CONFIG_MODEL_MAP[od_model_]).c_str(), model_path.c_str());
DumpDebugMessage( "QDEEP_CREATE_OBJECT_DETECT:%08X", result );
result = QDEEP_START_OBJECT_DETECT( this->detector_ );
DumpDebugMessage( "QDEEP_START_OBJECT_DETECT:%08X", result );
//result = m_pQDEEP_START_OBJECT_DETECT( this->detector_ );
PF_OBJECT_DETECT_EVENT_CALLBACK object_detect_event_callback = { 0 };
object_detect_event_callback = on_object_detect_event;
result = QDEEP_REGISTER_OBJECT_DETECT_EVENT_CALLBACK( this->detector_, object_detect_event_callback, this );
//m_pQDEEP_REGISTER_OBJECT_DETECT_EVENT_CALLBACK( this->detector_, object_detect_event_callback, this );
DumpDebugMessage( "QDEEP_REGISTER_OBJECT_DETECT_EVENT_CALLBACK:%08X", result );
this->start_detector_flag_ = true;
}
return nullptr;
}Here is the debug level server log.
2024-10-04 07:51:50.980 63ac DEBUG PluginManager(0x1fdf36cc7f0): (after loading plugin vca_analytics_plugin) SetDllDirectoryW(null) succeeded
2024-10-04 07:51:50.981 63ac INFO PluginManager(0x1fdf36cc7f0): Considering to load Server plugin [C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/vca_edge_analytics_plugin/vca_edge_analytics_plugin.dll]
2024-10-04 07:51:50.981 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin vca_edge_analytics_plugin) GetDllDirectoryW(0, nullptr) -> 1
2024-10-04 07:51:50.981 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin vca_edge_analytics_plugin) GetDllDirectoryW(1, result) -> 0 ""
2024-10-04 07:51:50.981 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin vca_edge_analytics_plugin) SetDllDirectoryW("C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/vca_edge_analytics_plugin") succeeded
2024-10-04 07:51:50.984 63ac INFO PluginManager(0x1fdf36cc7f0): Loaded Server Plugin [C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/vca_edge_analytics_plugin/vca_edge_analytics_plugin.dll] (main interface nx_sdk_analytics_IPlugin, sdk version "4.2.0 R4")
2024-10-04 07:51:50.984 63ac DEBUG PluginManager(0x1fdf36cc7f0): (after loading plugin vca_edge_analytics_plugin) SetDllDirectoryW(null) succeeded
2024-10-04 07:51:50.984 63ac INFO PluginManager(0x1fdf36cc7f0): Considering to load Server plugin [C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/vivotek_analytics_plugin.dll]
2024-10-04 07:51:50.984 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin vivotek_analytics_plugin) GetDllDirectoryW(0, nullptr) -> 1
2024-10-04 07:51:50.984 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin vivotek_analytics_plugin) GetDllDirectoryW(1, result) -> 0 ""
2024-10-04 07:51:50.984 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin vivotek_analytics_plugin) SetDllDirectoryW("") succeeded
2024-10-04 07:51:50.986 63ac INFO PluginManager(0x1fdf36cc7f0): Loaded Server Plugin [C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/vivotek_analytics_plugin.dll] (main interface nx_sdk_analytics_IPlugin, sdk version "6.0.0 R5")
2024-10-04 07:51:50.986 63ac DEBUG PluginManager(0x1fdf36cc7f0): (after loading plugin vivotek_analytics_plugin) SetDllDirectoryW(null) succeeded
2024-10-04 07:51:50.987 63ac INFO PluginManager(0x1fdf36cc7f0): Considering to load Server plugin [C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/yuan_plugin/yuan_plugin.dll]
2024-10-04 07:51:50.987 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin yuan_plugin) GetDllDirectoryW(0, nullptr) -> 1
2024-10-04 07:51:50.987 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin yuan_plugin) GetDllDirectoryW(1, result) -> 0 ""
2024-10-04 07:51:50.987 63ac DEBUG PluginManager(0x1fdf36cc7f0): (before loading plugin yuan_plugin) SetDllDirectoryW("C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/yuan_plugin") succeeded
2024-10-04 07:51:50.994 63ac ERROR PluginManager(0x1fdf36cc7f0): Failed loading Server Plugin [C:/Program Files/Network Optix/Nx Meta/MediaServer/plugins/yuan_plugin/yuan_plugin.dll] (): [cannotLoadLibrary]: Cannot load library C:\Program Files\Network Optix\Nx Meta\MediaServer\plugins\yuan_plugin\yuan_plugin.dll: The specified module could not be found.
2024-10-04 07:51:50.994 63ac DEBUG PluginManager(0x1fdf36cc7f0): (after loading plugin yuan_plugin) SetDllDirectoryW(null) succeeded
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'c:\Windows\system32\config\systemprofile\AppData\Local\nx_ini\'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'c:\Windows\system32\config\systemprofile\AppData\Local\nx_ini\'. Success: true
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'windows registry is used'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'windows registry is used'. Success: true
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for '\HKEY_LOCAL_MACHINE\Software\Network Optix\Network Optix MetaVMS Media Server'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for '\HKEY_LOCAL_MACHINE\Software\Network Optix\Network Optix MetaVMS Media Server'. Success: true
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for '\HKEY_LOCAL_MACHINE\Software\Network Optix\Network Optix MetaVMS Media Server'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for '\HKEY_LOCAL_MACHINE\Software\Network Optix\Network Optix MetaVMS Media Server'. Success: true
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'c:/Program Files/Network Optix/Nx Meta/MediaServer/external.dat'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'c:/Program Files/Network Optix/Nx Meta/MediaServer/external.dat'. Success: true
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server/staticWebContent.dat'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server/staticWebContent.dat'. Success: true
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server'
2024-10-04 07:51:50.994 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server'. Success: true
2024-10-04 07:51:50.995 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server/backup'
2024-10-04 07:51:50.995 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server/backup'. Success: true
2024-10-04 07:51:50.995 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server/downloads'
2024-10-04 07:51:50.995 63ac DEBUG nx::vms::server::RootFileSystem(0x1fdf3d59da0): Done with changing ownership for 'c:/Windows/system32/config/systemprofile/AppData/Local/Network Optix/Network Optix MetaVMS Media Server/downloads'. Success: true0 -
We would kindly suggest checking which specific dependencies are causing the issue, as well as confirming whether the *
lib
in question is indeed a static library. From what I can gather, it is possible that your library is not actually a static library?
Although its extension islib
, it may still be an import library. If yourlib
file is significantly smaller than the correspondingdll
file, this is often an indicator that it is an import library rather than a static one.
In other words, while the file may have alib
extension, it could simply contain references to functions exported by thedll
, rather than the full code itself. You could run thedumpbin /exports
command on yourlib
file. If it generates a list of functions, it’s likely an import library and not a static one.
What we can clarify is that if your LIB file is a reference to the functions and symbols within the DLL, then the DLL itself is required. The actual code for those functions resides in the DLL, which must be available during runtime.
It might help to add the path to the environment variable, or alternatively, ensure the DLL is placed in the plugin folder or the server application directory. However, this falls under your implementation, so we are unable to provide a definitive answer on that.
--
Additionally, one thing we noticed in your implementation is that you are triggering or enabling object detection within the "settingsReceives()" method.
This seems to be an inappropriate use of the method, as it is not intended for that purpose. We understand you might have specific concerns or need to address certain cases, but as a suggestion, object detection should not be handled in this method.
Hope this helps and thank you for your understanding.0
Please sign in to leave a comment.
Comments
3 comments