wrapping a c++ header file for use in c#
The following struct is currently implemented inside of a C++ .h (header) file. As far as I know most of the members of the struct are not C# defined types. I would like to make this struct user friendly for C#. How would I got about wrapping this struct in a dll or something and making the definition more C#-friendly?
Code:
typedef struct
{
FILETIME date;
DWORD dwRefId;
BYTE btParam[512];
CHAR szImageFileName[1];
UCHAR szSerialNum[17]; //Unit serial number.
RGBQUAD pixels[1];
RGBTRIPLE foreground;
} CMD_DATAA, *PCMD_DATAA;
Re: wrapping a c++ header file for use in c#
Why don't you "smash" it into pieces rather than wraping it up?
Re: wrapping a c++ header file for use in c#
Not sure what you are implying, but redesign is not an option. The header file is what it is. The question is how to wrap a dll around the header.
Re: wrapping a c++ header file for use in c#
Quote:
Originally Posted by Mollet
Why don't you "smash" it into pieces rather than wraping it up?
You may have some misunderstandings about methodologies applied. I think the OP simply wanted to use a pure wrapping method to integrate his C++ struct into C# language. Smashing or dividing objects as what you may be thinking of would hit badly application performance and memory allocation in general.
Quote:
Originally Posted by sambo
The following struct is currently implemented inside of a C++ .h (header) file. As far as I know most of the members of the struct are not C# defined types. I would like to make this struct user friendly for C#. How would I got about wrapping this struct in a dll or something and making the definition more C#-friendly?
........
Not sure what you are implying, but redesign is not an option. The header file is what it is. The question is how to wrap a dll around the header.
There is surely no need in actuality to redesigning anything. I have no idea of how to help what you are trying to accomplish. Thereotically, an interface and a generator should be what wrapping needs to be activated...