Hello
I have a DLL written in C and I am struggling with using the functions that return a structure in C#.
C Code that compiles into dll
I need to use this function in C#, this is what i tried:Code:typedef struct { unsigned int Height; //!< Height of the image in pixels. unsigned int Width; //!< Width of the image in pixels. unsgined short ***Pixels; } IMAGE; //! Creates and initializes image structure and returns pointer to new image __declspec(dllexport) IMAGE CreateImage(unsigned int aHeight, unsigned int aWidth);
But when I callCode:public struct IMAGE { int Height; int Width; short[,,] Pixels; } [DLLImport("IMAGE.dll")] public static extern IMAGE CreateImage(int aHeight, int aWidth);
I get the error: Method's type signature is not PInvoke compatibleCode:IMAGE image = new IMAGE(); image = CreateImage(100,100);
Other functions that return plain integers work just fine. Someone please explain how I can use a structure created by DLL.
Thanks


Reply With Quote
.
