I want to call .dll function in MyPawn.cpp.
ERRCODE_T AMyPawn::Pm5Init() {
FString filePath = FPaths::Combine(*FPaths::GameDir(), TEXT("Binaries/Win64/"), TEXT("PM3DDICP.dll"));
if (FPaths::FileExists(filePath)) {
//GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, filePath);
void *DLLHandle;
DLLHandle = FPlatformProcess::GetDllHandle(*filePath);
if (DLLHandle != NULL) {
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "File exist!!");
}else {
//GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "File no exist!!");
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, "Handler fail TT");
}
}else {
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, filePath);
}
GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Red, filePath);
return 0;
}
At first filePath is true and file exist but DLLHandle is null… I don’t know why…
using UnrealBuildTool;
using System.IO;
public class TestDLL : ModuleRules
{
public TestDLL(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore” });
PublicIncludePaths.AddRange(new string[] {“PM3Plugin/Public”, “PM3Pluin/Classes”,“AIModule”,“RHI” });
PrivateDependencyModuleNames.AddRange(new string[] { });
PublicAdditionalLibraries.Add("C:/Users/HSS/Desktop/unreal_workspace/TestDLL/Binaries/Win64/PM3CsafeCP.lib");
PublicAdditionalLibraries.Add("C:/Users/HSS/Desktop/unreal_workspace/TestDLL/Binaries/Win64/PM3DDICP.lib");
PublicAdditionalLibraries.Add("C:/Users/HSS/Desktop/unreal_workspace/TestDLL/Binaries/Win64/PM3USBCP.lib");
PublicDelayLoadDLLs.Add("C:/Users/HSS/Desktop/unreal_workspace/TestDLL/PM3CsafeCP.dll");
PublicDelayLoadDLLs.Add("C:/Users/HSS/Desktop/unreal_workspace/TestDLL/PM3DDICP.dll");
PublicDelayLoadDLLs.Add("C:/Users/HSS/Desktop/unreal_workspace/TestDLL/PM3USBCP.dll");
}
}
this is the build.cs file
when i call .dll file lnk2019 error is occured please help me…TT