Hi,
I've done some performance measurement on different styles of P-Invoke signatures. The original signature takes 3 doubles as an argument. I have experimented by adding an overload which takes a struct as an argument, where the struct contains 3 doubles. Somehow this method is about a factor 15 slower!
Is there a bug in the marshaling As far as I can find information about it, a struct only containing blittables, should itself also be blittable (see http://msdn2.microsoft.com/en-us/library/75dwhxf7.aspx). So therefore I would have expected the exact same performance.
The struct is defined as follows:
[StructLayout(LayoutKind.Sequential)]
public struct Point {
public double x, y, z;
}
Wout

P-Invoke struct marshaling performance issue.
Bruno J.C. Nunes
Anyway, I'm looking for a solution. Would moving to C++/CLI and using IJW be a proper way out Oh, note that I'm building a managed wrapper for some native code, so I'll be using it from C# mainly. So going the IJW way would mean having some static methods forwarding the calls using IJW.
Alternative I could write a static C# method doing the call, but doing the P-Invoke overload seemed more elegant (except for the compiler screwing it up again).
Wout
Gulden
looknow12