Hi,

Thanks for DaniWeb for its contribution.

I was looking for a understandable example to the problem "How marshalling happens when it comes C# from C++ specially for structure", And i am glad that i got a nice example in this forum.

However, i am in problem when it comes to pointer to structure. Let me put some samples here;

Example:
struct Dept
{
   int dept_no;
   char name[24];
};

struct Emp
{
   int emp_no;
   int emp_name[24];
   struct Dept *stDept;
};

In above example, the problem line is "struct Dept *stDept;".

I would like to inform you that i am able to solve below pointer involvement:

Example: Working code

C++ : void* hThreadHandle;
C# : public IntPtr hThreadHandle;

Example: Not working code

struct Dept *stDept;

Thanks in advance for reply.

You can only work with pointers in C#, if you put the code in an unsafe block.
Plus, you must mark it also in the build tab of the properties window of your project.
Hope it helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.