diff --git a/src/core/modulemanager.cpp b/src/core/modulemanager.cpp index 36e7c38..c3fcd1e 100644 --- a/src/core/modulemanager.cpp +++ b/src/core/modulemanager.cpp @@ -33,6 +33,24 @@ fastweb::module_manager::~module_manager() } void fastweb::module_manager::start() { + auto get_last_error_desc = []()->std::string { + DWORD dwError = GetLastError(); + // 获取错误描述 + char* lpMsgBuf = nullptr; + FormatMessageA( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dwError, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&lpMsgBuf, + 0, + NULL + ); + // 输出错误描述 + return std::string(lpMsgBuf); + }; close(); auto ms = modules(); for (size_t i = 0; i < ms.size(); i++) @@ -44,7 +62,7 @@ void fastweb::module_manager::start() mi.dll = LoadLibrary(mod_filepath.c_str()); if (mi.dll == nullptr) { - LOG_ERROR("module loading failed, filename: " + mod_filepath); + LOG_ERROR("module loading failed, filename: " + mod_filepath+","+ codec::to_utf8(get_last_error_desc())); continue; } mi.func = (fastweb_module_regist)GetProcAddress((HMODULE)mi.dll, "fastweb_module_regist"); diff --git a/src/module/buffer.cpp b/src/module/buffer.cpp deleted file mode 100644 index 5f28270..0000000 --- a/src/module/buffer.cpp +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/module/buffer.h b/src/module/buffer.h deleted file mode 100644 index 94af6d5..0000000 --- a/src/module/buffer.h +++ /dev/null @@ -1,16 +0,0 @@ -//#pragma once -//#include "sol/sol.hpp" -//#include "base/buffer.h" -//namespace module -//{ -// class buffer -// { -// public: -// buffer(); -// ~buffer(); -// -// void apd_str(const std::string& value); -// void apd_str(const char*); -// }; -//} -//