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");
}
}
프로그래밍중인 플랫폼은 무엇입니까? 나는 단지 "LoadLibrary failed"를 구글에 입력했고, 즉시 "LoadLibrary failed with error code 126"으로 자동 완성되었고,이를 해결하는 방법에 관한 YouTube 비디오를 포함하여 41.000의 결과를 주었다. 실제로 유용한 링크가 아닙니다. –
몇 가지 자습서를 따랐는데, 종속성에 대해 이야기했습니다. dll이 존재하지 않는다는 것에 대해 말입니다. 4 시간 동안 검색을 했으므로 어떤 자습서로도 문제를 해결할 수 없으며, 이미 종속성을 확인했습니다 .... : S – Spamdark
'if (dll_mod == NULL)'에서'FreeLibrary (dll_mod);를 호출하는 것은 좋지 않습니다. – borisbn