0

LoadLibray returns 0 when I'm trying to load a dll file. I'm using Visual Studio 2017

#include "App.h"
#include <windows.h>
#include <iostream>

using namespace std;

typedef int(__stdcall *f_funci)(unsigned char, unsigned int);

int main(int argc, char **argv) {

    SetDllDirectory((LPCWSTR)L"C:\\xmrig-master\\build\\Debug");
    HINSTANCE hGetProcIDDLL = LoadLibrary(L"asm.dll");

    if (!hGetProcIDDLL) {
        cout << "could not load the dynamic library" << endl;
        //return EXIT_FAILURE;
    }else{
        cout << "cy" << endl;
    }
    /*
    f_funci assemblerMode = (f_funci)GetProcAddress(hGetProcIDDLL, "asm");

    if (!assemblerMode) {
        cout << "could not locate the function " << assemblerMode << GetLastError() << endl;
        //return EXIT_FAILURE;
    }

    cout << "assemblerMode() returned " << assemblerMode(1,0) << endl;
    //*/
    App app(argc, argv);
    return app.exec();
}
3
Contributors
10
Replies
26
Views
5 Months
Discussion Span
Last Post by rproffitt
0

I wonder about that L in the () line 11. Also, just call out the full path since well, may as well try it. Of course if there are permission issues or the dll is bum, none of this applies.

0

I removed the L and I tried like this:

HINSTANCE  hGetProcIDDLL = LoadLibrary((LPCWSTR)"c:\\xmrig-master\\build\\Debug\\asm.dll");

still the same

0

Why was that L there? I've never seen that? Didn't the compiler bark at you?

Also, now that we know a bit more about what you are trying to build. Back to https://github.com/xmrig/xmrig/wiki/Windows-Build

If the build instructions fail, ask them why or how to fix.

PS. I wish folk would share when they are trying to build apps from github.

Edited by rproffitt: Added PS.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.