I’m not a very experienced c++ programmer at all and am having problems getting a .dll dynamic library loaded in the correct way.
I am following this tutorial and just managed to get it to work.
The problem is that I have not managed to reference the proper/nice function names. I am using VS preset for compiling dll’s but the names keep coming out mangled so that in the UE4 code, to get it to work, I now have to do:
FString procName = "?SimpleTest@@YAHXZ"; // the exact name of our dll function to recover. HAVE NOT MANAGED TO DO NICE NAMES! DLLgetValue = (_SimpleTest)FPlatformProcess::GetDllExport(DLLHandle, *procName); // get the dll function need
I have read up on this elsewhere and people are suggesting different methods but surely for a simple case of a single standalone function like ‘SimpleTest()’ in this case, the VS preset should work and not give me the mangled names?
And for you that have done this, should I also be able to export whole full classes for use?
EDIT: I just actually managed to export my simple test function by using my own macro:
#define DllFuncExport extern “C” __declspec( dllexport )
(I thought I had tried that but must have made some other error then.)
The question then remains, should I be able to somehow export a full and complex class without getting names mangled?
As extern “C” seems to not work as it is meant for c code compatibility, that don’t have the concept of classes.