Here's my problem: We have a math library written in C++ that is heavily using SSE. We need to use that same math library in our the managed layer of our tools (which are written in C#).
The problem is, that the math library classes must be 16-byte aligned (for SSE to work). However when compiling the managed code, I get lots of errors, because the "__declspec (align(X))" is not supported.
Any ideas whether this is possible somehow? I wasn't able to find any useful information.
Some additional information:
The math library, written in C++, uses SSE for maximum performance. However our tool does not require maximum performance, we can even take a performance hit compared to general C# code. It is more about being able to actually execute all our code (it is a huge code base), without having people to convert back and forth between data types.
So this is really only about usability, not about performance.
I tried this: I put all our math functions into a cpp, instead of having them as inline functions. Now they are exported from their own DLL. However the vector-class of course still has a __m128 private member for its data.
As soon as I just put such a variable in managed code, the compiler tells me that my managed code is now native code.
Does that mean I must not have such a type in my class definition and hide it completely behind a DLL interface? Thanks.