Third party plugin not included correctly in packaged game

Hi everyone,

I use a third party plugin in a program to get access OpenCV functionalities. The plugin I use is this one: GitHub - Brandon-Wilson/OpenCV-Plugin: A simple OpenCV plugin that integrates the OpenCV library into UE4. The plugin includes some blueprint classes that demonstrate how OpenCV can interact with the engine.

Everything works perfectly fine in the editor. The problem is, once I package the project for Win64 the program crashes as soon as the first line of OpenCV code would be executed. The program starts normally and everything works, but as soon as a class uses something from OpenCV, the program crashes. The error message is the following:

[ 87]LogWindows: Error: === Critical error: ===
[ 87]LogWindows: Error: 
[ 87]LogWindows: Error: Fatal error!
[ 87]LogWindows: Error: 
[ 87]LogWindows: Error: Unhandled Exception: 0xc06d007e
[ 87]LogWindows: Error: 
[ 87]LogWindows: Error: [Callstack] 0x00007fff437d4ed9 UnknownFunction []  <-this one changes
[ 87]LogWindows: Error: [Callstack] 0x0000000000000002 UnknownFunction []
[ 87]LogWindows: Error: 

My first thought was that something with the Build.cs file was wrong. I already had to make changes as the plugin was made for an older UE4 version. There, everything seems fine, though. I do the following, if a win64 platform is detected:

//Add Include path
            PublicIncludePaths.AddRange(new string[] { Path.Combine(OpenCVPath, "Includes") });

            // Add Library Path 
            PublicSystemLibraryPaths.Add(LibPath);

            //Add Static Libraries
            PublicAdditionalLibraries.Add(Path.Combine(LibPath, "opencv_world320.lib"));//was previously just "opencv_world320.lib", without the LibPath appended

            RuntimeDependencies.Add(Path.Combine(LibPath, "opencv_world320.dll"));
            RuntimeDependencies.Add(Path.Combine(LibPath, "opencv_ffmpeg320_64.dll"));

            //Add Dynamic Libraries
            PublicDelayLoadDLLs.Add("opencv_world320.dll");
            PublicDelayLoadDLLs.Add("opencv_ffmpeg320_64.dll");

I checked the packaged game and everything seems to be in place. The dlls were copied to the ThirdParty\OpenCV\Libraries\Win64 folder inside the packaged output, which correlates to LibPath. I googled the exception, but that wasn’t helpful.

Hello! I am now experiencing this issue with a plugin and was curious if you found a resolution. Thanks!

try to copy opencv_world320.dll to packaged output dir: [program]/Binaries/Win64.