x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to load (own) DLL in Runtime?

Greetings, for my current project I need to to bind some dlls for the game (Runtime). I tested it in the Editor (PIE) and everthing worked fine but after I packaged the game I get the error, that my dlls couldn't be loaded. I find out that the Path from my plugin doesn't point to a "valid" address.

How I get the plugin address

  IPluginManager::Get().FindPlugin("ThatCoolPlugin")->GetBaseDir();
  DllNameDir = FPaths::Combine(*PluginDir, TEXT("Binaries/Name/Win64/dllName.dll"));

My question is how should I bind the dll so the packaged game can find the dll? Currently the Binaries are stored in a "Binaries" folder in the "ThatCoolPlugin" folder, which is in the plugin folder.

How I load the Dlls

 DllNameHandle = !DllNameDir .IsEmpty() ? FPlatformProcess::GetDllHandle(*DllNameDir ) : nullptr;

Some details: I used common ways to load unload the dll. My plugin settings (Rules) can be compared with the Third Party Library Example plugin. The major differents between these settings is, that my setting type is Runtime not development.

Edit: What I want to know is, what do I need to do if an plugin is from the type "Runtime", while I load dlls? I saw that in the packaged Game has a Engine/Binaries/ThirdParty folder. But their are dlls such PhysX. VR, et cetera. Is it possible to write a Plugin (or something else) which store his binaries in the same folder? or in another folder where the engine can find it?

Product Version: UE 4.10
Tags:
more ▼

asked Feb 19 '16 at 02:03 AM in C++ Programming

avatar image

Conan
69 5 6 9

avatar image Conan Feb 27 '16 at 03:49 PM

Any advice? This is a serious issue in the current porject I'm working on.

avatar image b_higgerson Oct 29 '18 at 03:23 AM

Hi Conan, did you ever work out a solution for this? Sorry that everyone else posting gave you such a crappy answer :(

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Did you tried this set up? if you can you should link dll staticly to UE4 module.

https://wiki.unrealengine.com/Linking_Static_Libraries_Using_The_Build_System

more ▼

answered Mar 02 '16 at 01:03 AM

avatar image

Shadowriver
33.2k 915 163 1084

avatar image Conan Mar 03 '16 at 11:21 PM

I didn't try it because I want to link dynamic not static. But I don't see any way to achive this. I will mark your answer as best because at least it solve the problem. I hope this will be possible in the future :) thanks for the helpful answer :)

(comments are locked)
10|2000 characters needed characters left

My understanding is it isn't really supported yet due to security concerns. Having said that have a dig around the UT forums because I think others have been pursuing this avenue.

Can you refactor to get the dll logic into blueprints? This should be currently supported and is the approach I'm following but it's also a better fit for my particular distribution model.

more ▼

answered Feb 27 '16 at 04:50 PM

avatar image

theonecalledtom
1.2k 57 59 265

avatar image Conan Mar 01 '16 at 11:43 AM

what do you mean with refactor? To implment the dll logic into blueprint? I have access to the source code from the dll but I don't have the permission to modify it.

avatar image theonecalledtom Mar 01 '16 at 02:54 PM

Can you provide an actual example of what you are trying to do?

avatar image Conan Mar 01 '16 at 04:32 PM

What I'm trying can be achieved by making the "ThirdParty Plugin example" runtime capable. Just create a new "ThirdParty Plugin" then change the Type to Runtime in the .uplugin file. But after that the engine cannot finde the dll direction in the packaged game

avatar image theonecalledtom Mar 01 '16 at 11:15 PM

I meant more like "final result in game". Why a dll is required in the first place (why you can't ship exe logic in a single exe and extend it in blueprints).

Honestly you're outside my experience here but pathing in DLC is a little tricky. If you are packaging the dll within a pak file I've found that:

  • Paths within the pak file are relative to its mount path (use the -List UnrealPak option to see where they are).

  • Paths within the pak file are the relative path between the point the pak file was created at and the files that were put in it. If you create a pak file at c:\afolder\mypakfile.pak then c:\afolder\bfolder\c.file will have the path bfolder\c.file

  • Mount point for a pak file is set within the FPakPlatformFile::Mount function (i.e. final path is combination of the path provided to mount AND the path within the packfile.

  • There is a second mount point, for unreal content (mounting uassets into the unreal asset browsing system). This is setup using FPackageName::RegisterMountPoint

  • For this second mount point new calls with and old mountpoint will replace previous calls, so you can't mount two things to /DLC/ you'll need /DLC1/ and /DLC2/

Really not sure if any of this helps you! Can you see the dll in the final packaged game directory structure?

Again, you're outside my experence but mounting a dll sounds likely platform specific and something that has seemed not supported in the few places I've come across it, but I look forward to someone chiming in here and detailing how its going to work (especially in a nice wrapped up portable manner!).

Good luck :)

avatar image Shadowriver Mar 02 '16 at 01:01 AM

What Pak has anything to do with this? All dll should be outside of any achieve to be usable

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question