how to import dll function in unreal

You do that as in any C++ project just need to properly configuratated, here some tutorial on those (UE4 wiki process is currently under maintnence and code formating is broken, click “View Source” to see code snippets properly):

But if you making those libraries just for UE4 use, you should avoid doing so. Unity does this because Unity don’t provide C/C++ compilation support, so in order to use native C/C++ only libraries or use C/C++ in general you need to make dll which then is used in C# scripts as Mono/.NET supports dll importing.

UE4 doesn’t need for that as you got C++ out of the box and form there you could do anything that you can in C++ and if you want to do something separate from main game code you can just make seperate UE4 module which will create seperate dll:

https://docs.unrealengine.com/en-us/Programming/UnrealBuildSystem/ModuleFiles

And optionally you can place this module to plugin to make it reusable in all UE4 projects

And regardless if you gonna import dll or rewrite everything in to UE4, you most likely will need to write APIs for UE4 use. UE4 APIs are not compatible with C++ Standard Library or even C standard library, UE4 API use it own standard APIs and warps anything external needed around it and because of that you need to convert types when you use any library that use Standard C++ library types. And obviuesly you need to do when you import dlls too, so if you can do something in UE4 APIs do it in UE4 APIs to make it more compatible and straight forward