How to properly integrate libraries into Unreal?

For a program I am making with UE5 I need to use the netcdf4 libraries. This is their download page:
https://downloads.unidata.ucar.edu/netcdf/

I’ve looked into the documentation on implementing third party libraries into unreal and .libs seem to be quite simple, however, .dlls seem to be platform specific. I want to be able to build to windows, mac, and linux, though so how exactly do I implement netcdf such that it preserves cross compatibility?

Look at build.cs and upl.xml (be careful about their includes, too)

  1. Create a C++project.

  2. Create a Plugin from Plugins tab.

  3. Add your includes and libraries to your build.cs like sample plugin.

  4. If your library is static, you are ready. Just right click your .uproject and select Generate Visual Studio Project Files. After that, you can use include "your_third_party.h"

  5. If your library is dynamic, you have two extra steps for each platform of you supported.

For Windows:

  1. Create a void* function in your Plugin_Name.h like this sample
    PDF_Reader/PDF_Reader.h at main · FF-Projects-UE/PDF_Reader · GitHub

  2. Write a delayed load in your startup module like this.
    PDF_Reader/PDF_Reader.cpp at main · FF-Projects-UE/PDF_Reader · GitHub

For Android and iOS:

  1. Add your .so files like UPL.xml (you can see it at first link)
    You have to create seperate UPL.xml if you want to support both iOS and Android. If your library is static, you don’t need to create one and add it to your build.cs
    UPL is same for both mobile platform but probably directory structure is different. I don’t have Apple exprience and Apple devices. So, I can’t tell true paths.

As I know Mac doesn’t support delayed loads and they doesn’t support .dll. They have their own dynamic library extension. Build.cs structure will be same. Just add them inside of platform if. If they need another step, I don’t know.

Thank you following those links you provided helped me get it working!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.