hi

i am trying to explicitly link a dll to my console application however LoadLibrary() keeps returning with error 126: the specified module could not be found

the file is in the same folder as the exe, and i've tried moving it to system32 and it's the same error, so i'm guessing it's coding related:

main project:

if( enablePlugins )
    {
        vector<string> Plugins = CFG.ParsePlugins( "main", "plugins", ';' );

        if( Plugins.empty( ) )
        {
            cout << "No plugins found" << endl;
        }
        else
        {
            ProcessCommands _ProcessCommands;

            HINSTANCE hInstLibrary = LoadLibrary( ( LPCWSTR ) Plugins.front( ).c_str( ) );

            if( hInstLibrary )
            {
                _ProcessCommands = ( ProcessCommands ) GetProcAddress( hInstLibrary, "Greet" );

                _ProcessCommands( );

                FreeLibrary( hInstLibrary );
            }
            else
            {
                cout << "Plugin: " << Plugins.front( ) << " failed to load: " << GetLastError( ) << endl;
            }
        }
    }

dll:

#include <iostream>

__declspec(dllexport) void Greet( void );

__declspec(dllexport) void Greet( void )
{
    std::cout << "dleague successfully loaded" << std::endl;
}

Plugins.front( ) returns properly, which is the string "dleague.dll", that's all i really checked, not too familiar with this stuff, my only other guess is that the loadlibrary() typecasting is causing an issue ?

This question has already been answered. Start a new discussion instead.