yoshinoToylogic / bulletsharp

Automatically exported from code.google.com/p/bulletsharp
MIT License
0 stars 0 forks source link

AccessViolationException when DLL is build as Release #52

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Build Bulletsharp as Generic Release
2. Run the following code:
RigidBodyConstructionInfo ci = new RigidBodyConstructionInfo( 0, null, null );
RigidBody r = new BulletPhysics.RigidBody( ci );
3. AccessViolationException gets thrown

Please provide any additional information below.
The code will run if BulletSharp is build as Debug.

Original issue reported on code.google.com by ma...@progressivemedia.dk on 28 May 2013 at 1:01

GoogleCodeExporter commented 8 years ago
I couldn't reproduce this, but can you try:
RigidBodyConstructionInfo ci = new RigidBodyConstructionInfo( 0, null, null, 
Vector3.Zero );

I suspect that the C++/CLI compiler is trying to pass the default parameter 
localInertia=btVector3(0,0,0) without alignment (alignment is required for SSE) 
and Bullet reads the parameter from an unaligned address on the stack using SSE 
instructions. So currently it might work only if the parameter happens to be 
aligned to a 16-byte boundary.

A possible fix is to replace lines 439 and 455 in Rigidbody.cpp with:
#if defined(BT_USE_SSE_IN_API) && defined (BT_USE_SSE)
instead of:
#if defined(BT_USE_SSE_IN_API)

Original comment by andres.traks on 28 May 2013 at 2:19

GoogleCodeExporter commented 8 years ago
It worked using RigidBodyConstructionInfo ci = new RigidBodyConstructionInfo( 
0, null, null, Vector3.Zero ); :)

Thanks!

Original comment by ma...@progressivemedia.dk on 28 May 2013 at 2:25