我使用Windows API中的'LoadLibrary',當我運行應用程序時,它會拋出一個錯誤代碼126.我讀到它可能是由依賴項引起的,我檢查了什麼是有些應用程序如Dependency Walker錯誤,但一切都很好。DLL加載庫 - 錯誤代碼126
調用LoadLibrary中的應用:
HMODULE dll_mod = LoadLibrary(L"path_to_dll");
if(dll_mod==NULL){
std::stringstream error;
error << "Could not load plugin located at:\n" << file_full.toStdString() << "\n" << "Error Code: " << GetLastError();
FreeLibrary(dll_mod);
return error.str();
}
插件代碼:
#include "stdafx.h"
#define DLL_EXPORT
#define PLUGIN_STREAM __declspec(dllexport)
#include <iostream>
#include <vector>
using std::vector;
using std::string;
// Init event (After the loading)
extern "C"{
PLUGIN_STREAM int onInit(char* argv){
return 0;
}
PLUGIN_STREAM void pluginInfo(vector<string> & info){
info.push_back("media_event=false");
info.push_back("status_event=false");
info.push_back("send_event=true");
info.push_back("plugin_name='RadioStream'");
info.push_back("description='This plugin was designed for that people that wants to listen to radio music.\nYou can register your radio and play it later, also we have a gallery of radios that you can check.\nThis plugin is original of Volt and it's originally implemented in the application.'");
info.push_back("success:0");
info.push_back("error:1=Could not open data file");
info.push_back("error:2=Could not prepare plugin");
info.push_back("alert:40=Could not connect to that radio");
}
}
你在哪個平臺上編程?我只是在Google上輸入「LoadLibrary failed」,並立即自動完成「LoadLibrary失敗,錯誤代碼爲126」,給出了類似41.000的結果,包括YouTube視頻如何修復它。是不是真的有用的那些鏈接? –
我跟着一些教程,他們談論了依賴......關於這個DLL不存在,好吧,我有4個小時的搜索,我不能用任何教程修復它,我已經檢查了依賴關係.... :S – Spamdark
調用'FreeLibrary(dll_mod);'if'(dll_mod == NULL)'' – borisbn