C++ Dll not working in Windows 7

  • Thread starter Thread starter DasNeo
  • Start date Start date
D

DasNeo

Guest
Hey,

I wrote a DLL (Dll2.dll) in VC++ to use on Windows 10 and Windows 7. The DLL is working on Windows 10 but fails on Windows 7.

The DLL is being called from a C# program.

Error Message:

Dll2.dll: The specified module could not be found.

1342793.png

DLL-Code:


dll.h

__declspec(dllimport) int test(LPSTR User, LPSTR Pass, LPSTR Host, LPSTR File, LPSTR Remote);


dll2.cpp
extern "C"
{
__declspec(dllexport) int test(LPSTR S1, LPSTR S2, LPSTR S3, LPSTR S4, LPSTR S5)
{
try {
System::String^ SS1 = gcnew System::String(S1);
System::String^ SS2 = gcnew System::String(S2);
System::String^ SS3 = gcnew System::String(S3);
System::String^ SS4 = gcnew System::String(S4);
System::String^ SS5 = gcnew System::String(S5);
return test(SS1, SS2, SS3, SS4, SS5);
}
catch (const std::exception) {
return 0;
}
}
}


targetver.h

#pragma once

// Including SDKDDKVer.h defines the highest available Windows platform.

// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#define _WIN32_WINNT_WIN7 0x0601
#include <SDKDDKVer.h>



Am I missing something?


Kind regards,

André.

Continue reading...
 
Back
Top