ENH: network: load dlls from current directory if failed
JIRA: no-jira Change-Id: I86efafe3aefac85d56879a68f864a52c0e62fca5 (cherry picked from commit cdf0859e78e8d62c2de13f2f9bf56a216a79a12a) (cherry picked from commit b4cc20ac14298bac2e928d1d598e9d75ca953ba3)
This commit is contained in:
parent
f5270603b2
commit
a7f58f39cf
1 changed files with 12 additions and 4 deletions
|
@ -171,6 +171,13 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||||
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str()) + 1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str()) + 1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
||||||
netwoking_module = LoadLibrary(lib_wstr);
|
netwoking_module = LoadLibrary(lib_wstr);
|
||||||
}*/
|
}*/
|
||||||
|
if (!netwoking_module) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", try load library directly from current directory");
|
||||||
|
library = std::string(BAMBU_NETWORK_LIBRARY) + ".dll";
|
||||||
|
memset(lib_wstr, 0, sizeof(lib_wstr));
|
||||||
|
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str())+1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
||||||
|
netwoking_module = LoadLibrary(lib_wstr);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
library = plugin_folder.string() + "/" + std::string("lib") + std::string(BAMBU_NETWORK_LIBRARY) + ".dylib";
|
library = plugin_folder.string() + "/" + std::string("lib") + std::string(BAMBU_NETWORK_LIBRARY) + ".dylib";
|
||||||
|
@ -300,7 +307,7 @@ int NetworkAgent::initialize_network_module(bool using_backup)
|
||||||
get_model_mall_rating_result_ptr = reinterpret_cast<func_get_model_mall_rating_result>(get_network_function("bambu_network_get_model_mall_rating"));
|
get_model_mall_rating_result_ptr = reinterpret_cast<func_get_model_mall_rating_result>(get_network_function("bambu_network_get_model_mall_rating"));
|
||||||
|
|
||||||
get_mw_user_preference_ptr = reinterpret_cast<func_get_mw_user_preference>(get_network_function("bambu_network_get_mw_user_preference"));
|
get_mw_user_preference_ptr = reinterpret_cast<func_get_mw_user_preference>(get_network_function("bambu_network_get_mw_user_preference"));
|
||||||
get_mw_user_4ulist_ptr = reinterpret_cast<func_get_mw_user_4ulist>(get_network_function("bambu_network_get_mw_user_4ulist"));
|
get_mw_user_4ulist_ptr = reinterpret_cast<func_get_mw_user_4ulist>(get_network_function("bambu_network_get_mw_user_4ulist"));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -419,7 +426,7 @@ int NetworkAgent::unload_network_module()
|
||||||
put_rating_picture_oss_ptr = nullptr;
|
put_rating_picture_oss_ptr = nullptr;
|
||||||
put_model_mall_rating_url_ptr = nullptr;
|
put_model_mall_rating_url_ptr = nullptr;
|
||||||
get_model_mall_rating_result_ptr = nullptr;
|
get_model_mall_rating_result_ptr = nullptr;
|
||||||
|
|
||||||
get_mw_user_preference_ptr = nullptr;
|
get_mw_user_preference_ptr = nullptr;
|
||||||
get_mw_user_4ulist_ptr = nullptr;
|
get_mw_user_4ulist_ptr = nullptr;
|
||||||
|
|
||||||
|
@ -448,12 +455,13 @@ void* NetworkAgent::get_bambu_source_entry()
|
||||||
memset(lib_wstr, 0, sizeof(lib_wstr));
|
memset(lib_wstr, 0, sizeof(lib_wstr));
|
||||||
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str())+1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str())+1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
||||||
source_module = LoadLibrary(lib_wstr);
|
source_module = LoadLibrary(lib_wstr);
|
||||||
/*if (!source_module) {
|
if (!source_module) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", try load BambuSource directly from current directory");
|
||||||
library = std::string(BAMBU_SOURCE_LIBRARY) + ".dll";
|
library = std::string(BAMBU_SOURCE_LIBRARY) + ".dll";
|
||||||
memset(lib_wstr, 0, sizeof(lib_wstr));
|
memset(lib_wstr, 0, sizeof(lib_wstr));
|
||||||
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str()) + 1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str()) + 1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0]));
|
||||||
source_module = LoadLibrary(lib_wstr);
|
source_module = LoadLibrary(lib_wstr);
|
||||||
}*/
|
}
|
||||||
#else
|
#else
|
||||||
#if defined(__WXMAC__)
|
#if defined(__WXMAC__)
|
||||||
library = plugin_folder.string() + "/" + std::string("lib") + std::string(BAMBU_SOURCE_LIBRARY) + ".dylib";
|
library = plugin_folder.string() + "/" + std::string("lib") + std::string(BAMBU_SOURCE_LIBRARY) + ".dylib";
|
||||||
|
|
Loading…
Reference in a new issue