How to translate C++ typedefs into C# ?

  • Thread starter Thread starter Oleg Subachev
  • Start date Start date
O

Oleg Subachev

How to translate the following C++ typedefs into C# ?

typedef struct {
BYTE *data;
size_t length;
} VizBlob;

typedef struct VizUserInfoActions {
HANDLE (IMPORTED *createFullInfo) (
HANDLE logger,
const VizBlob *blob
);
const VizBlob *(IMPORTED *fullInfoBlob) (
HANDLE logger,
HANDLE fi,
int version);
} VizUserInfoActions;
 
you can transform these structs into structs or classes in C#

public class VizBlob
{
public byte[] data;
}

public class VizUserInfoActions
{
public delegate IntPtr createFullInfo(IntPtr Logger, VizBlob blob);
public delegate VizBlob fullInfoBlob( IntPtr logger,
IntPtr fi, int version)
}

However those IntPtrs can also be substituted by appropriate class
definitions. IntPtr is used for the interop with the Win32 world...

I recommend you to see the docs about structs, classes and delegates ( they
are like function pointers in C++ )
 
Back
Top