Integrating ctranslate2 with Unreal Engine

Hi folks! I’ve been trying to get ctranslate2 up and running in an Unreal Engine project that my team and I are working on, but I’ve been hitting some roadblocks and would really appreciate a second pair of eyes from someone who’s more familiar with the ctranslate2 project.

I have some test code that I’ve taken straight from the quickstart guide, and I’ve verified that this works with my locally compiled version of ctranslate2 in a standalone C++ project. I’ve adapted this code into an Unreal Engine plugin.

When I run this code in the unreal plugin, the model is able to load in and translate the provided batch (the output is a bit garbled but for now I don’t mind that), but the program crashes when destroying the created translator object. I’m afraid I haven’t been able to put my finger on what might be causing this, but I suspect that Unreal’s low level memory manager could have something to do with it?

My ctranslate2 binaries are compiled on Windows with Visual Studio 2022 using the default cmake config. For testing purposes I’ve put together an empty test project in Unreal Engine which can be accessed here: CTranslate2Unreal.7z - Google Drive

The test project is built with Unreal Engine 5.3, which you’ll need in order to generate the solution files and run the code. Any help or insights from the community would be really appreciated here! Thanks in advance.