C#C
C#2y ago
Silme94

C# DLL failed to load

Am trying to make a dll that can be called from C++, when i load the dll file i get this exception
Here is the C++ code where i try to call dll and full C# code

#include <iostream>
#include <Windows.h>

typedef void(__cdecl* DEBUG)();

int main() {
    HMODULE hModule = LoadLibraryA("HttCppLibrary.dll");
    if (hModule != NULL) {
        auto debug = (DEBUG)GetProcAddress(hModule, "DEBUG");
        debug();
        std::cout << "debug is called\n";
        FreeLibrary(hModule);
    }
    else {
        std::cout << "Failed to load DLL" << std::endl;
    }

    return 0;
}
ssssssssq.PNG
zzzzzzzzb.PNG
Was this page helpful?