# Fatal error trying to call function in packaged game

**URL:** <https://forums.unrealengine.com/t/fatal-error-trying-to-call-function-in-packaged-game/448476>\
**Category:** Platform & Builds\
**Tags:** buildcs, unreal-engine, crash, packaging-projects, CPP, question\
**Created:** [May 6, 2019, 2:21pm UTC](https://forums.unrealengine.com/t/fatal-error-trying-to-call-function-in-packaged-game/448476 "2019-05-06T14:21:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexeyGet](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlexeyGet](https://forums.unrealengine.com/u/AlexeyGet)\
**Post date:** [May 6, 2019, 2:21pm UTC](https://forums.unrealengine.com/t/fatal-error-trying-to-call-function-in-packaged-game/448476/1 "2019-05-06T14:21:05Z")

</div>

I’m trying to use Third Party Library in my plugin for write PDF document and get fatal error in builded game (Windows 64-bit).  
In editor all works fine.

library: [https://github.com/galkahana/PDF-Writer](https://github.com/galkahana/PDF-Writer)

Error occurs when call:

```
PDFUsedFont * font = PdfWriter->GetFontForFile(fontpath, 0L);

```

this function returns NULL in DebugGame in Local Windows Debugger

In build.cs I’m include all .lib files:

```
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, ../../Source/PDFWriter4_0/Build/LibAesgm.lib")));
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Source/PDFWriter4_0/Build/Zlib.lib")));
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Source/PDFWriter4_0/Build/LibTiff.lib")));
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Source/PDFWriter4_0/Build/LibJpeg.lib")));
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Source/PDFWriter4_0/Build/FreeType.lib")));
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Source/PDFWriter4_0/Build/libpng_64.lib")));
PublicAdditionalLibraries.Add(Path.GetFullPath(Path.Combine(ModuleDirectory, "../../Source/PDFWriter4_0/Build/PDFWriter.lib")));

```

In packaged game log I have:

```
    [2019.04.05-14.46.17:507][43]LogWindows: Error: === Critical error: ===
    [2019.04.05-14.46.17:507][43]LogWindows: Error: 
    [2019.04.05-14.46.17:507][43]LogWindows: Error: Fatal error!
    [2019.04.05-14.46.17:507][43]LogWindows: Error: 
    [2019.04.05-14.46.17:507][43]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000
    [2019.04.05-14.46.17:507][43]LogWindows: Error: 
    [2019.04.05-14.46.17:507][43]LogWindows: Error: [Callstack] 0x00007ff76cd661d0 pdfWriterPlugin.exe!UnknownFunction []
    ...
    [2019.04.05-14.46.17:507][43]LogWindows: Error: [Callstack] 0x00007ff9fb34b85d USER32.dll!UnknownFunction []
    [2019.04.05-14.46.17:507][43]LogWindows: Error: [Callstack] 0x00007ff9fb34b1ef USER32.dll!UnknownFunction []
    [2019.04.05-14.46.17:507][43]LogWindows: Error: [Callstack] 0x00007ff769baef76 pdfWriterPlugin.exe!UnknownFunction []
    ...
    [2019.04.05-14.46.17:508][43]LogWindows: Error: [Callstack] 0x00007ff9f9a81fe4 KERNEL32.DLL!UnknownFunction []
    [2019.04.05-14.46.17:508][43]LogWindows: Error: [Callstack] 0x00007ff9fc0ff061 ntdll.dll!UnknownFunction []
    [2019.04.05-14.46.17:508][43]LogWindows: Error: 

```

I think that UE4 have some troubles with FreeType.lib, in VS it has no intellisense highlight.

I’m already has try to:

1. Add .h files from FreeType.lib to source/PDFWriter4\_0/FreeType/include and add this path to “PublicIncludePaths” and/or ''PrivateIncludePaths" in my build.cs file
2. Use Engine FreeType2 Library from Epic Games\UE\_4.22\Engine\Source\ThirdParty\FreeType2
3. Use FreeType 2.6.0 (as in editor Runtime) instead FreeType 2.4.11 in shipping build (change FreeType.Build.cs in Engine\Source\ThirdParty\FreeType2) - this don’t help (LogSlate: Using FreeType 2.4.11)

Sorry for my English
