This topic seems like don’t have final answer sammeek4 was right. It’s possible to use C# dll with ue4 without using COM or anything like that.Here you’ve got how to create managed dll with unmanaged export (so u can use it without .net virtual machine). Later u got to paste dll to the project folder. Don’t forget to add dll info in your Build.cs file [ i got something like this PublicDelayLoadDLLs.Add("UnmanagedFrameworkDll.dll");
]
After completing this I put following code in my BlueprintFunctionLibrary.cpp
void *v_csdllHandle;
typedef int(*_MyCsDllLibraryFunction)();
_MyCsDllLibraryFunction m_myCsDllLibraryFunctionHandle;
bool UMyDllBlueprintFunctionLibrary::importCsDLL(FString folder, FString name)//same as no c# version. only the handle changed
{
FString filePath = *FPaths::ProjectPluginsDir() + folder + "/" + name;
if (FPaths::FileExists(filePath))
{
v_csdllHandle = FPlatformProcess::GetDllHandle(*filePath); // Retrieve the DLL.
if (v_csdllHandle != NULL)
{
return true;
}
}
return false; // Return an error.
}
bool UMyDllBlueprintFunctionLibrary::LoadMyCSharpDLLFuntion()
{
if (v_csdllHandle != NULL)
{
m_myCsDllLibraryFunctionHandle = NULL;
//now u need to pass the exact name of the dll function
FString procName = "UnmanagedFunction";
m_myCsDllLibraryFunctionHandle = (_MyCsDllLibraryFunction)FPlatformProcess::GetDllExport(v_csdllHandle, *procName);
if (m_myCsDllLibraryFunctionHandle != NULL)
{
return true;
}
}
return false;
}
int UMyDllBlueprintFunctionLibrary::CallMyCSharpDLLFuntion()
{
return m_myCsDllLibraryFunctionHandle();
}