Sto usando la 'LoadLibrary' dall'API di Windows, quando eseguo l'applicazione, mi lancia un codice di errore 126. Ho letto che potrebbe essere causato dalle dipendenze, ho controllato cosa è sbagliato con alcune applicazioni come Dependency Walker, ma tutto andava bene.Libreria di caricamento DLL - Codice di errore 126
LoadLibrary nell'applicazione:
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();
}
codice del plugin:
#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");
}
}
su quale piattaforma state programmando? Ho appena digitato "LoadLibrary failed" su Google e si è completato automaticamente con "LoadLibrary failed with error code 126", fornendo qualcosa come 41.000 risultati, compresi i video di YouTube su come risolverlo. non è davvero utile uno di questi link? –
Ho seguito alcuni tutorial, hanno parlato delle dipendenze ... a proposito che la DLL non esiste, beh, ho 4 ore di ricerca e non riesco a risolverlo con nessun tutorial, ho già controllato le dipendenze .... : S – Spamdark
Non è consigliabile chiamare 'FreeLibrary (dll_mod);' sotto 'if (dll_mod == NULL)' – borisbn