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++ )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top