I'm new to C# and have the following problem that I hope is simple for
you C# experts out there!
I have a need to call an unmanaged DLL (written in C) that needs the
following structure defined (C syntax):
typedef struct {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[256];
} bmBITMAPINFO;
Note how the second item is an array of 256 items and it's in that
physical block, not a reference to another block.
I'm trying to replicate this in C# so I can set up this structure and
pass it to my DLL. I don't see any obvious way to do it as arrays are
all "by reference" and this doesn't work (I need the actual data in that
structure, not a pointer to the data).
Example:
// defined in Dll.cs
public struct BmBitmapInfoStruct
{
public BITMAPINFOHEADER bmiHeader;
public RGBQUAD [] bmiColors;
}
// later... in main code...
bmi = new Dll.BmBitmapInfoStruct();
bmi.bmiColors = new Dll.RGBQUAD[256];
doesn't give the desired result as only the pointer is placed into the
structure, not the actual data.
Thanks for any insights,
Dave