# how use a DLL function?

**URL:** <https://forums.unrealengine.com/t/how-use-a-dll-function/1871>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [April 4, 2014, 10:28pm UTC](https://forums.unrealengine.com/t/how-use-a-dll-function/1871 "2014-04-04T22:28:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_4c14f0a7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4c14f0a7](https://forums.unrealengine.com/u/anonymous_user_4c14f0a7)\
**Post date:** [April 4, 2014, 10:28pm UTC](https://forums.unrealengine.com/t/how-use-a-dll-function/1871/1 "2014-04-04T22:28:18Z")

</div>

hello people!!!, i need know, how is the correct way to use a DLL inside UE4 and the using inside a bluprintcallable function.  
any idea are welcome, thanks for the help!!!

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [April 5, 2014, 12:23am UTC](https://forums.unrealengine.com/t/how-use-a-dll-function/1871/2 "2014-04-05T00:23:31Z")

</div>

It’s C++, you can do anything that you can do in C++, including use of any liberies normally from there header files instead of using dll call hacks like in UnrealScript

What DLL you want to use?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_4c14f0a7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_4c14f0a7](https://forums.unrealengine.com/u/anonymous_user_4c14f0a7)\
**Post date:** [April 5, 2014, 12:48am UTC](https://forums.unrealengine.com/t/how-use-a-dll-function/1871/3 "2014-04-05T00:48:20Z")

</div>

hello my DLL is something special to comunicate hardware via serial port, but actually i made a little example with simple maths funtions,  
inside unreal i try this after regular constructor:  
float Ahardware::getCilinderArea(float radius, float height)  
{

```
      HINSTANCE hardwareDLL = LoadLibrary(_T("C:\\Users\\yoshito3d\\Documents\\Visual Studio 2013\\Projects\\hardware\\Debug\	est.dll"));

FARPROC getFunction = GetProcAddress(HMODULE(hardwareDLL), "getCilinderArea");

typedef float(__stdcall * pICFUNC)(float, float);

float output = getCilinderArea(radius, height);

FreeLibrary(hardwareDLL);

return output;

```

}

---

<div class="post-metadata">

**Author:** ![Bob\_Gneu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bob\_Gneu](https://forums.unrealengine.com/u/Bob_Gneu)\
**Post date:** [April 5, 2014, 1:00am UTC](https://forums.unrealengine.com/t/how-use-a-dll-function/1871/4 "2014-04-05T01:00:57Z")

</div>

This may also be of use.

> **[Walkthrough: Create and use your own Dynamic Link Library (C++)](https://docs.microsoft.com/en-us/cpp/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp?redirectedfrom=MSDN&view=msvc-160)**
>
> Use C++ to create a Windows dynamic-link library (DLL) in Visual Studio.
