Frans Bouma wrote: > Although there is one weird thing: > (and you know more on this than I do I think): the D3D structs are > redefined in these formats: > > [StructLayout(LayoutKind.Sequential, Size=24, Pack=1), > CLSCompliant(false), MiscellaneousBits(65), DebugInfoInPDB] > public struct _D3DBOX > { > > } > > Without contents. > > Perhaps in combination with unmanaged code, I'm not sure.
I think this is because D3DBOX is an unmanaged type and IIRC the content of the structure isn't available in the type library. From a managed perspective it is just a bunch of bytes (24 bytes, as you can see in the StructLayout attribute). In the Managed DirectX SDK there is probably a value type with the same layout and the wrapper just casts the pointer types. Something like this: [StructLayout(LayoutKind.Sequential, Size=24, Pack=1)] struct Box { uint Left; uint Top; uint Right; uint Bottom; uint Front; uint Back; } unsafe void SomeRandomBoxApi(Box b) { pComObject.SomeRandomBoxApi((_D3DBOX*)&b); } Now the question is, since SomeRandomBoxApi takes a pointer to a _D3DBOX (which is equivalent to a pointer to a Box), why pass in the Box by value? This would be (much?) more efficient: unsafe void SomeRandomBoxApi(ref Box b) { fixed(Box* p = &b) { pComObject.SomeRandomBoxApi((_D3DBOX*)p); } } Regards, Jeroen =================================== This list is hosted by DevelopMentorŪ http://www.develop.com Some .NET courses you may be interested in: NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com