Hello,
I have been following the Wiki Tutorial here, its a great tutorial but of course I’m having trouble with my DLL.
Here is a code snippet:
if (FPaths::FileExists(filePath))
{
void *DLLHandle;
DLLHandle = FPlatformProcess::GetDllHandle(*filePath); // retrieve the DLL
if (DLLHandle != NULL)
{
_Return5 DLLReturn5 = NULL;
FString procName = "Return5";
DLLReturn5 = (_Return5)FPlatformProcess::GetDllExport(DLLHandle, *procName);
if (DLLReturn5 != NULL)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::FromInt(DLLReturn5()));
}
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("DLL ERROR!!"));
}
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("DLL NOT FOUND!!"));
}
The code above is pretty much straight from the Wiki except I’ve added some debug messages. I get the “DLL ERROR!!” message which means GetDllExport was unable to retrieve my function.
My question is: How do I debug this? I’m pretty new with Unreal so I’m not quite sure how to go about this. Is there a way to see why GetDllExport failed? Surely this engine has error messages somewhere…right?
Additional details: The function in my DLL is a simple function which returns the number 5 as an int while this is a simple function created for testing, the DLL has other more complex functions. I have typed the function name correctly.
Someone please help me.