Hi everyone, I’m working on integrating Jolt Physics into a Defold project on Windows.
The Issue:
I have a working version where I include Jolt source files directly in my extension (in src/), and it works perfectly. However, when I try to switch to a precompiled Jolt.lib, I get an Access Violation crash at JPH::BodyManager::AllocateBody immediately upon calling CreateAndAddBody during the extension initialization.
Build Configuration:
I’ve ensured that the Runtime Library matches (using /MT via DUSE_STATIC_MSVC_RUNTIME_LIBRARY=ON). I am using the following CMake flags to build the library:
cmake -G "Visual Studio 18 2026" -A x64 -S Build -B dist ^
-DCMAKE_INSTALL_PREFIX="C:/libs/jolt-5.5.0-release-msvc" ^
-DCMAKE_CXX_FLAGS="-DJPH_DEBUG_RENDERER" ^
-DTARGET_SAMPLES=OFF ^
-DTARGET_UNIT_TESTS=OFF ^
-DUSE_STATIC_MSVC_RUNTIME_LIBRARY=ON ^
-DCPP_EXCEPTIONS_ENABLED=OFF ^
-DCPP_RTTI_ENABLED=ON ^
-DOVERRIDE_CXX_FLAGS=ON ^
-DINTERPROCEDURAL_OPTIMIZATION=OFF
cmake --build dist --config Release --target install
What I’ve verified:
- RTTI is enabled in both the Jolt build and my extension code.
- The
PhysicsSystemis initialized before creating bodies. - The crash occurs regardless of RTTI settings.
Question:
Could this be an ABI mismatch related to virtual interface implementation (e.g., BroadPhaseLayerInterface) when moving from source-included to precompiled .lib? Has anyone encountered similar issues with Jolt virtual interface alignment in Defold/Windows?
Any advice on which additional flags or build configurations I should check would be appreciated!