Is it possible to call a managed .NET dll from UE4 C++ project?
I have some libraries I've written in C# I'd like to call. Is this possible? Normally I could add the /clr option but since building is all done with custom makefiles I'm not sure how to go about it.
asked Apr 25 '14 at 08:54 AM in C++ Programming
Yes , why not ? I did it. Create a C# library dll project in your UE4 solution and refer its build path to your plugin directory. Then write a function in C# , like this :
The above function gives info on your current PC domain. Now build the project , see if a dll is created in your plugin directory.
Then create a BPFunctionlibrary C++ class , and add a function , that can be called in your BP. My function to retrieve domain information is given below :
If the DLLFuncPtr is coming as null , please write a blank function before other functions in yuor C# , like below :
because I dont know the reason , but the first function in your C# class in never detected
You cannot directly use C# in your project. I've used a C# dll by using a CLI C++ DLL and then using LoadLibrary and GetProcAddress to load the functions.
That would be my suggestion if you can't just rewrite it in C++.
answered Mar 27 '15 at 12:14 AM
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
Follow this question
Once you sign in you will be able to subscribe for any updates here