Loading DLLs from Plugins
I am in the process of creating a plugin that will load the Mono runtime, and allow scripting of the Unreal Engine using any Mono-supported CIL language.
I have this process running successfully, however I am looking to now clean the package up somewhat. Namely; I wish to provide all required third-party libraries within the plugin folder structure.
Is there a system in place within the plugin architecture to allow me to define the search path for loading of required third-party libraries?
I would rather not pollute the binaries (or Third Party!) directory with additional DLLs exclusively for my plugin if at all possible.
asked Apr 08 '14 at 11:23 AM in C++ Programming
This has been addressed for 4.8!
It is now possible to include third-party dependencies directly in the plug-in folder without having to manually copy them to the Engine directory. I have attached a ZIP file that contains a sample plug-in project, which includes a fake third-party module in the form of full source code. Having source code for the dependency is generally preferred, because developers can then simply compile everything for whatever platform they need.
However, source code is not always available. In many cases you only have a pre-compiled DLL or Dylib that you wish to include. Those, too, are supported in plug-ins now. The attached example does not currently show this workflow, but I have attached a second file from a VLC plug-in that I am currently working on. I hope to have the entire code on GitHub later today or tomorrow - then you can take a close look at how it's done.
The main trick for pre-compiled libraries is the RuntimeDependencies array, which is used to tell UBT about those third-party libraries. When packaging a project, those files will then automatically be included.
Another complication that sometimes arises is that DLLs have to be bound dynamically at run-time (especially when LGPL licensed), i.e. via LoadLibrary(), GetProcAddress() and similar mechanisms. This can be accomplished with FPlatformProcess::GetDllHandle() and passing in the path to the plug-ins third party directory. For example, I use the following to get the correct path in my VLC plug-in:
I will update this answer when I have the VLC code checked in. Then you can look at a working example.
answered Jun 17 '15 at 03:35 PM
Update: This has been addressed in 4.8. See my other answer!
This is a great question, and you're not the first person to ask :)
The bad news is that, currently, you have to manually copy the third party DLLs into the ThirdParty or Engine/game Binaries directory. This will, as you pointed out, pollute those directories.
The good news is that this is on our radar. We already have a TTP for it, and we will try to fix this as soon as possible. The goal is to allow for third-party DLLs in the plug-in's Binaries directory or some other directory inside the plug-in folder, so that plug-ins are completely self contained.
answered Aug 19 '14 at 06:19 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here