« Return to Thread: change SWIG c++ aligned class into c# struct during SWIG?
I want to change the output of my SWIG of the class btVector3 to a struct btVector3. The main issue I'm having is that I'm using BulletPhysics and I need a few core components to use structs as normal to prevent cache trashing."btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-byte alignment when btVector3 is stored in containers."************************** C++ aligned class ************************__declspec(align(16)) class btVector3{public:union {__m128 mVec128;btScalar m_floats[4];};//...}
************************** c# Wrapper OUTPUT ************************public class btVector3 : IDisposable {private HandleRef swigCPtr;protected bool swigCMemOwn;internal btVector3(IntPtr cPtr, bool cMemoryOwn) {swigCMemOwn = cMemoryOwn;swigCPtr = new HandleRef(this, cPtr);}internal static HandleRef getCPtr(btVector3 obj) {return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;}~btVector3() {Dispose();}public virtual void Dispose() {lock(this) {if (swigCPtr.Handle != IntPtr.Zero) {if (swigCMemOwn) {swigCMemOwn = false;BulletPhysicsPINVOKE.delete_btVector3(swigCPtr);}swigCPtr = new HandleRef(null, IntPtr.Zero);}GC.SuppressFinalize(this);}}///...}************************** C# Wrapper GOAL (TARGET) ************************[StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]public struct btVector3 {[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]public float[] m_floats;}}
C.H. Bourke Floyd IV
« Return to Thread: change SWIG c++ aligned class into c# struct during SWIG?
| Free embeddable forum powered by Nabble | Forum Help |