I’ve statically linked a .dll to my project that exports a class with a C interface using no Unreal specific types. I created an Actor class that exposes a BlueprintCallable method that allocates the exported class on the heap (“new”), calls one of its methods to retrieve some data, and then deallocates it (“delete”). When I create a Blueprint that gets an instance of the Actor and calls the BlueprintCallable method, one of the two exceptions is thrown at random:
Unhandled exception at 0x000007FED1BF1789 (UE4Editor-Core.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x000000010000AC44.
Unhandled exception at 0x000007FECDD608FF (UE4Editor-SlateCore.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x000000010000AC44.
When I instantiate my exported class on the stack however, the exceptions aren’t thrown. Within the exported class I also allocate and free memory. Perhaps this is causing memory to become corrupt?