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