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"

[Solved] load DLLs in Plugins

Hello everyone,

I'm developing a plugin based on a project I already have. I'm trying to import it as a ThirdParty library. I've successfully created the plugin, imported the library and linked .lib and .dll, created an ActorComponent that uses the library.

Now the problem: the project I have is composed by 2 DLLs. But at runtime the Editor is able to load the module but just one of the DLLs (always the same). I tried to move the missing DLL in the Editor directory as well (where UE4Editor.exe is) but nothing. The project compiles, the game starts, but it crashes as I try to access to the library. The whole system worked in previous versions of my library.

I tried to load these libraries into another C++ project (a normal VS application) and it works, so I guess that the libraries are good.

Is there a way to understand why ue4 is not able to load that dll?

A plugin contains an ActorComponent that uses a library. The Build.cs for the plugin is

 private string ThirdPartyPath
 {
     get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../ThirdParty/")); }
 }
 
 private string PhaserThirdParty
 {
     get { return Path.GetFullPath(Path.Combine(ThirdPartyPath, "PhaserLibrary/")); }
 }
 
 public PhaserPlugin(TargetInfo Target)
 {
     PublicIncludePaths.AddRange(
         new string[] {
             "PhaserPlugin/Public", Path.Combine(PhaserThirdParty, "Include") } );
         
     PrivateIncludePaths.AddRange(
         new string[] {
             "PhaserPlugin/Private"} );
         
     PublicDependencyModuleNames.AddRange(
         new string[] {"Core", "PhaserLibrary", "Projects"} );
 }

The plugin (PhaserPlugin) depends on PhaserLibrary (added in the PublicDependencyModuleNames). It uses my system, Phaser that depends on Boost and a parser I wrote for Emma XML. The related Build.cs is:

 private void LoadLib(TargetInfo Target) {
     Type = ModuleType.External;

     if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
     {
         string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "Win64" : "Win32";
         string PhaserLibPath = Path.Combine(ModuleDirectory, "Lib");
         string BoostLibPath = Path.Combine(BoostThirdParty, "Lib");
         string EmmaLibPath = Path.Combine(EmmaThirdParty, "Lib");
 
         PublicAdditionalLibraries.Add(Path.Combine(PhaserLibPath, PlatformString, "Phaser.lib"));
         PublicAdditionalLibraries.Add(Path.Combine(EmmaLibPath, PlatformString, "EmmaParser.lib"));
         PublicAdditionalLibraries.Add(Path.Combine(BoostLibPath, PlatformString, "libboost_system-vc140-mt-1_61.lib"));
 
         PublicDelayLoadDLLs.Add("Phaser.dll");
         PublicDelayLoadDLLs.Add("EmmaParser.dll");
     }
 }
 
 public PhaserLibrary(TargetInfo Target) {
     PublicIncludePaths.AddRange(
         new string[] {
             Path.Combine(BoostThirdParty, "Include"),
             Path.Combine(EmmaThirdParty, "Include"),
             Path.Combine(ModuleDirectory, "Include")
         }
     );
 
     LoadLib(Target);
 }

Of course, all the paths have been checked

Product Version: UE 4.12
Tags:
more ▼

asked May 07 '17 at 10:32 AM in C++ Programming

avatar image

Dario Di Mauro
6 1 2 5

avatar image BrUnO XaVIeR May 07 '17 at 10:54 AM

Show your Build.cs files

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I solved.

I was missing other libraries, but the system didn't say nothing.

more ▼

answered May 08 '17 at 03:11 PM

avatar image

Dario Di Mauro
6 1 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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