I want to use a C++ dll IN a c# code example (using the c++ dll):
class Program
{
[DllImport(@"netcoreapp3.1\savedecrypter.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern string decryptSave(string o);
static void Main(string[] args)
{
string ja = "dhsabdasji";
string show = decryptSave(ja);
Console.WriteLine(show);
Console.ReadLine();
}
}
**and this is the EXAMPLE C++ dll code(im just a newbie in c++ btw)**
extern "C"
{
__declspec(dllexport) string decryptSave(string path21)
{
return path21;
}
}
i got an error when trying to call it "System.DllNotFoundException: 'Unable to load DLL 'netcoreapp3.1\savedecrypter.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)'" can anyone fix this for me? Would appreciate if somebody could do so.
edit : now i have enabled native code debbuging, it show this error :
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Is possible that your 'savedecrypter' DLL has a call to another DLL that is missing in your machine. Check if you have all the required drivers, this is a common mistake when you are working with third-party 'black-box' DLL's.
User contributions licensed under CC BY-SA 3.0