Linking Libraries Using The Build System

I don’t know in what there can be a problem?
I want to add to ue4 to the project external dll with static linkage:

using UnrealBuildTool;
using System.IO;

public class TestThirdPerson : ModuleRules
public TestThirdPerson(TargetInfo Target)
PublicDependencyModuleNames.AddRange(new string[] { “Core”, “CoreUObject”, “Engine”, “InputCore” });


private string ModulePath
    get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }

private string ThirdPartyPath
    get { return Path.GetFullPath(Path.Combine(ModulePath, "..\\..\\..\\..\\")); }

public bool LoadBobsMagic(TargetInfo Target)
    bool isLibrarySupported = false;

    if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
        isLibrarySupported = true;
        PublicDelayLoadDLLs.Add(Path.Combine(ModulePath, "Mech_anime_15.dll"));
        PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "lib15\\Mech_anime_15.lib"));

    if (isLibrarySupported)
        // Include path
        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Include"));

    Definitions.Add(string.Format("WITH_BOBS_MAGIC_BINDING={0}", isLibrarySupported ? 1 : 0));

    return isLibrarySupported;


All compile is ok.

But process start is fail:

‘TestThirdPerson.exe’ (Win32): Loaded ‘G:\Mech_anime_git\UE4\TestThirdPerson\Binaries\Win64\Mech_anime_15.dll’. Symbols loaded.

Exception thrown at 0x000007FEFD1A940D in TestThirdPerson.exe: Microsoft C++ exception: xSharedMemoryException at memory location 0x000000000051F290.
‘TestThirdPerson.exe’ (Win32): Loaded ‘C:\Windows\System32\cryptbase.dll’. Cannot find or open the PDB file.
‘TestThirdPerson.exe’ (Win32): Loaded ‘C:\Windows\System32\sspicli.dll’. Cannot find or open the PDB file.
‘TestThirdPerson.exe’ (Win32): Loaded ‘C:\Windows\System32\uxtheme.dll’. Cannot find or open the PDB file.
[2015.12.29-15.03.26:025][ 0]LogModuleManager:Warning: ModuleManager: Module ‘HTTPChunkInstaller’ not found - its StaticallyLinkedModuleInitializers function is null.

Did you solve this problem? The same thing (or very similar) is happening to me. It packages but won’t open. Gives same xSharedMemoryException. I’m trying to use Kinect20.Face.dll

No, I have not decided. I set it aside for later. If you decide, please tell me.

I solved it! Don’t know if your problem will be the same, though.

What was happening

In my case, it worked on editor and compiled ok. But the packed game failed to initialize with an Exception trying to read a memory location.

The cause

I’m doing multi-threading and my FCriticalSection is static for ease of access when locking it from other classes. When I initialized one of my static instances of another class, it used that lock for safety, but the lock was not initialized in memory yet, since it’s class was not initialized yet either. It was a Static Initialization Fiasco and gave me read access exception.

The solution

Change the order I was doing things, not reading that static var right at the beginning of the program.

I hope it helps you!


Thanks you for the info. But it does not help me.