CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Location
    Corvallis, OR
    Posts
    315

    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;

  2. #2
    Join Date
    Apr 2006
    Posts
    1

    Re: wrapping a c++ header file for use in c#

    Why don't you "smash" it into pieces rather than wraping it up?

  3. #3
    Join Date
    May 2003
    Location
    Corvallis, OR
    Posts
    315

    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.

  4. #4
    Join Date
    Mar 2006
    Location
    You can guess, but it'll be wrong
    Posts
    12

    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...
    Emiene Vous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured